skiftet / speakout-api-client
2.3.3
2022-09-01 21:14 UTC
Requires
- php: ^7.4
- guzzlehttp/guzzle: ^6.2
- illuminate/support: ^6.20.44
- nesbot/carbon: ^2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- phpunit/phpunit: ^8.0
README
Installation
Run composer require skiftet/speakout-api-client
in your project root to install the package.
Usage
NOTE: The api currently only works with an in-development version of the Speakout api that isn't released yet
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();
TODO
- Implement creating new actions
- Hydrated models
- Decide whether to use active record or data mapper pattern for models
- Lazy loading model relationships