PHP code example of baorv / cleverreach

1. Go to this page and download the library: Download baorv/cleverreach 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/ */

    

baorv / cleverreach example snippets


Baorv\Cleverreach\ServiceProvider::class

php artisan vendor:publish --provider="Baorv\\CleverReach\ServiceProvider"



use Baorv\CleverReach\Http\GuzzleHttpClient;

$cleverReachApi = new GuzzleHttpClient('client_id', 'client_secret');
$cleverReachApi->authorize();

// Get access token
$accessToken = $cleverReachApi->getAccessToken();



use Baorv\CleverReach\Resources\Endpoints\Debug;

/** @var \Baorv\CleverReach\Http\GuzzleHttpClient $cleverReachApi */
$debugApi = new Debug($cleverReachApi);

$debugApi->exchange();



use Baorv\CleverReach\Resources\Endpoints\Reports;

app(Reports::class)->all();



use Baorv\CleverReach\Resources\Endpoints\Reports;
use Baorv\CleverReach\Exceptions\CleverReachException;

try {
    app(Reports::class)->all();
} catch (CleverReachException $ex) {
    // Log or do something with $ex
}



use Baorv\CleverReach\Resources\Endpoints\Reports;
use Baorv\CleverReach\Exceptions\CleverReachException;

/** @var \Baorv\CleverReach\Http\GuzzleHttpClient $cleverReachApi */
$reportApi = new Reports($cleverReachApi);

try {
    $reportApi->all();
} catch (CleverReachException $ex) {
    // Log or do anything with $ex
}