WritesonicPhp is a simple SDK implementation of Writesonic API. It helps accessing the API in an object oriented way.
please register an account and request an api key at Writesonic.
Please check out the tutorials section for more information
You can install the package via composer:
composer require devkind/writesonic-php
use Devkind\WritesonicPhp;
/** @var \Devkind\WritesonicPhp */
$writesonic = new WritesonicPhp(API_KEY);
alternatively we can initialize static
/** @var \Devkind\WritesonicPhp */
$writesonic = \Devkind\WritesonicPhp::make(API_KEY);
Endpoints are basically the type of content that is supported by Writesonic.
Each endpoint requireds an $engine
and $language
parameter to query from writesonic.
/** @var string $language */
protected $language = 'en';
/** @var string $engine */
protected $engine = 'economy';
it supports following engines :
economy, business
and it supports following languages :
en, nl, fr, de, it, pl, es, pt-pt, pt-br, ru, ja, zh, bg, cs, da, el, hu, lt, lv, ro, sk, sl, sv, fi, et
in order to change the language or engine we can call the setter methods, which is available on all the endpoints.
to set the language
/** @var \Devkind\WritesonicPhp\Endpoints\GenerateImage */
$endpoint = $writesonic->GenerateImage->setLanguage('br');
to set the engine
/** @var \Devkind\WritesonicPhp\Endpoints\GenerateImage */
$endpoint = $writesonic->GenerateImage->setEngine('business');
alternatively:
/** @var \Devkind\WritesonicPhp\Endpoints\GenerateImage */
$endpoint = $writesonic->GenerateImage->setEngine('br')->setLanguage('br');
All the endpoints can be called into three different ways
$object = new WritesonicPhp('test123');
/** @var \Devkind\WritesonicPhp\Endpoints\GoogleAds */
$endpoint = $object->GoogleAds;
$array = $endpoint->setPayload([
"product_name" => 'test',
"product_description" => 'test',
"search_term" => 'test',
])->get();
$object = new WritesonicPhp('test123');
/** @var \Devkind\WritesonicPhp\Endpoints\GoogleAds */
$endpoint = $object->GoogleAds;
/** @var array */
$array = $endpoint->setProductName('test')
->setProductDescription('test')
->setSearchTerm('test')
->get();
/** @var \Devkind\WritesonicPhp\Endpoints\GoogleAds */
$endpoint = $writesonic->GoogleAds;
/** @var array */
$endpoint->generate(
$product_name,
$product_description,
$search_term
);
/** @var array */
$endpoint = $writesonic->GoogleAds->get([
"product_name" => 'test',
"product_description" => 'test',
"search_term" => 'test',
]);
Click here to view the entire documentation of supported endpoints
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email backend@devkind.com.au instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.