PHP code example of skiftet / speakout-api-client

1. Go to this page and download the library: Download skiftet/speakout-api-client 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/ */

    

skiftet / speakout-api-client example snippets


use Skiftet\Speakout\Api\Client as Speakout;

$speakout = new Speakout([
    'endpoint' => '', // Set this to the url of a running Speakout deployment. E.g. 'http://localhost:3000'
    'user'     => '', // The username of a Speakout user
    'password' => '', // The correponding password
]);

/**
 * This will load request an array with all campaigns
 */
$campaigns = $speakout->campaigns()->all();

/**
 * This will request an array with all campaigns, sorted by action count
 */
$campaigns = $speakout->campaigns()->orderBy('actions')->get();

/**
 * You can also do nested queries for deeper filters. The example below will only
 * take actions since the 1st of March 2017 into account.
 */
$campaigns = $speakout->campaigns()->orderBy('actions')->has('actions', function (Query $query) {
    return $query->since('2017-03-01'); // this can also be an instance of \DateTime
})->get();