An API client to handle calls to the Marvel API.

0.0.5 2016-10-30 11:22 UTC

This package is not auto-updated.

Last update: 2021-10-16 03:17:24 UTC


Insight Build Status Scrutinizer Code Quality Installs Packagist license

Marvel API client

The Marvel Comics API allows developers everywhere to access information about Marvel's vast library of comics—from what's coming up, to 70 years ago. This Marvel API client helps you explore the Marvel universe with great ease.



Add the API client as a dependency to your project using Composer.

composer require ikoene/marvel-api-client



require_once dirname(__DIR__) . '/vendor/autoload.php';

use ikoene\Marvel\Client;

$client = new Client('your_public_api_key', 'your_private_api_key');

$response = $client->getCharacter(1009610);



You can call every endpoint with an explicitly defined method. So if you, for example, want a list of comics containing a specific character, you can call getComicsForCharacter().

$response = $client->getComicsForCharacter(1009610);

Optional filters

It's also possible to add optional filters to the calls. Let's get all comics for 'Spider-Man' which title starts with 'Age of Ultron' and order the results by 'title'.

$comicFilter = new \ikoene\Marvel\Entity\ComicFilter();
$comicFilter->setTitleStartsWith('Age of Ultron');

$response = $client->getComicsForCharacter(1009610, $comicFilter);

Pretty easy, right?


You can find some more examples here.

Additional info