PHP code example of viktoras / scryfall

1. Go to this page and download the library: Download viktoras/scryfall 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/ */

    

viktoras / scryfall example snippets


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();