adamhebby / glimeshclient
This package is abandoned and no longer maintained.
No replacement package was suggested.
PHP Client for GraphQL API on https://glimesh.tv/api
v1.1.0
2022-05-08 19:54 UTC
Requires
- php: >=8.1.0
- gmostafa/php-graphql-client: ^1.13
- guzzlehttp/guzzle: ^7.3
- psr/log: ^1.1
- ratchet/pawl: ^0.4.1
Requires (Dev)
- monolog/monolog: ^2.3
- phpunit/php-code-coverage: ^9.2
- phpunit/phpunit: ^9.5
- symfony/dotenv: ^5.3
Suggests
- monolog/monolog: For Logging the Client usage (Any PSR Logger will work)
- symfony/cache: For caching requests to Glimesh and reducing server load (Any PSR Cache will work)
This package is auto-updated.
Last update: 2023-09-19 20:58:43 UTC
README
PHP GlimeshClient
This Library aims to provide a fully working Glimesh Client, all objects and interfaces used by the API are auto-generated by the API specification.
Installation
composer require adamhebby/glimeshclient
Usage
<?php use GlimeshClient\Adapters\Authentication\OAuthFileAdapter; use GlimeshClient\Client; use GlimeshClient\Objects\Enums\ChannelStatus; use GraphQL\Query; use GuzzleHttp\Client as GuzzleHttpClient; use Symfony\Component\Dotenv\Dotenv; require_once __DIR__ . '/../vendor/autoload.php'; // Dotenv is not required! $dotenv = (new Dotenv())->load(__DIR__ . '/../.env'); $logger = new \Monolog\Logger("log"); $logger->pushHandler(new \Monolog\Handler\ErrorLogHandler()); $guzzle = new GuzzleHttpClient(['http_errors' => true, 'allow_redirects' => true]); $client = new Client( $guzzle, new OAuthFileAdapter( $_ENV['CLIENT_ID'], $_ENV['CLIENT_SECRET'], '/tmp/auth.json' ), $logger ); $object = $client->makeRequest( (new Query('channels'))->setSelectionSet([ 'id', (new Query('stream'))->setSelectionSet([ 'thumbnail', ]), ])->setArguments(['status' => 'ENUM:' . ChannelStatus::LIVE]) ); var_dump($object);