php-mtg/mtg-api-com-scryfall-object

A library that implements the php-mtg/mtg-api-com-scryfall-interface


README

A library that implements the php-mtg/mtg-api-com-scryfall-interface.

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-mtg/mtg-api-com-scryfall-object": "^4",
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

This library may be used the following way :


use PhpMtg\Scryfall\ScryfallApiEndpoint;

/* @var $client \Psr\Http\Client\ClientInterface */

$endpoint = new ScryfallApiEndpoint($client);

$collection = $this->_endpoint->getSets();

foreach($collection as $setResume)
{
	$page = 1;
	do
	{
		/** @var \PhpMtg\Scryfall\ScryfallApiPagination $pagination */
		$pagination = $this->_endpoint->getCardsSearch($page, 'e='.$setResume->getId());
		
		foreach($pagination->getData() as $card)
		{
			// do something with $card
		}
		
		$page++;
	}
	while($pagination->hasMore());
}

License

MIT (See license file).