viktoras / scryfall
Scryfall.com API client
v0.6
2022-04-27 20:48 UTC
Requires
- php: ^7.2||^8.0
- ext-json: *
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpstan/phpstan: ^1
- phpunit/phpunit: ^7||^8||^9
- roave/security-advisories: dev-latest
- vimeo/psalm: ^4.22
Suggests
- nyholm/psr7: A lightweight PSR-17 Factory implementation
- php-http/curl-client: A lightweight PSR-18 HTTP Client
README
Installation
composer require viktoras\scryfall
Usage
You need a PSR-18 compatible HTTP Client (e.g. php-http/curl-client) and a PSR-17 compatible RequestFactory (e.g. Nyholm/psr7).
Example Request:
use Http\Client\Curl\Client as HttpClient; use Nyholm\Psr7\Factory\Psr17Factory as Psr17FactoryAlias; use Viktoras\Scryfall\Client; $baseUrl = 'https://api.scryfall.com/'; $client = new Client\Client( $baseUrl, new HttpClient(), new Psr17FactoryAlias() ); $setsRequest = new Client\Request\Sets\SetsList(); /** @var Client\Response\Sets\SetsList $response */ $response = $client->request($setsRequest); $sets = $response->getSets();
Tests
There are some tests, although not many. You can invoke them using composer script: composer run-script test