PHP code example of devkind / writesonic-php

1. Go to this page and download the library: Download devkind/writesonic-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

devkind / writesonic-php example snippets



use Devkind\WritesonicPhp;

/** @var \Devkind\WritesonicPhp */
$writesonic  =  new WritesonicPhp(API_KEY);


/** @var \Devkind\WritesonicPhp */
$writesonic  =  \Devkind\WritesonicPhp::make(API_KEY);

/** @var \Devkind\WritesonicPhp\Endpoints\GenerateImage */
$endpoint = $writesonic->GenerateImage->setLanguage('br');


/** @var \Devkind\WritesonicPhp\Endpoints\GenerateImage */
$endpoint = $writesonic->GenerateImage->setEngine('business');


/** @var \Devkind\WritesonicPhp\Endpoints\GenerateImage */
$endpoint = $writesonic->GenerateImage->setEngine('br')->setLanguage('br');


$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',
]);
bash
composer