yaroslawww / laravel-workcast
This package is abandoned and no longer maintained.
The author suggests using the think.studio/laravel-workcast package instead.
workcast api integration for laravel
2.2.0
2023-07-09 06:36 UTC
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.4
- laravel/framework: ^9.0|^10.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.20
- orchestra/testbench: ^8.5
- phpunit/phpunit: ^10.2
- psalm/plugin-laravel: ^2.8
- vimeo/psalm: ^5.13
README
Api documentation you can find there
Installation
You can install the package via composer:
composer require think.studio/laravel-workcast
You can publish the config file with:
php artisan vendor:publish --provider="LaravelWorkcast\ServiceProvider" --tag="config"
Configuration in .env
WORKCAST_API_KEY='066t...L21135A='
Usage
Paginated request example for listings:
$pagination = Workcast::events()->list([ 'limit' => 50 ]); foreach ($pagination->items() as $item) { echo $item['eventPak']; } if ($pagination->hasNext()) { echo $pagination->nextLink(); // Workcast::events()->callPagination($pagination->nextLink()); }
Single entity request:
$item = Workcast::events()->get(22); dd($item->json());
By default in package specified this list of endpoints:
But you can also specify you own endpoint:
use LaravelWorkcast\Endpoints\AbstractEndpoint; use LaravelWorkcast\Endpoints\HasRestFullRead; use LaravelWorkcast\Endpoints\WithRestFullRead; class Presenters extends AbstractEndpoint implements HasRestFullRead { use WithRestFullRead; protected int $eventId; public function __construct(Auth $auth, int $eventId) { $this->eventId = $eventId; parent::__construct($auth); } public function baseUrl(): string { return "presenters/{$this->eventId}/sessions/" . $this->key(); } public function key(): string { return 'presenters'; } } $pagination = (new Presenters(Workcast::getAuth(), 33))->list([ 'limit' => 50 ]);