chadicus/marvel-api-client

v2.0.1 2017-04-18 12:57 UTC

README

Build Status Code Quality Code Coverage

Latest Stable Version Latest Unstable Version License

Total Downloads Daily Downloads Monthly Downloads

A PHP client for use with the Marvel API.

Requirements

The Marvel API Client requires PHP 5.6 (or later).

Composer

To add the library as a local, per-project dependency use Composer! Simply add a dependency on chadicus/marvel-api-client to your project's composer.json file such as:

{
    "require": {
        "chadicus/marvel-api-client": "^2.0"
    }
}

Examples

Examples of use can be found here.

Basic Usage

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Chadicus\Marvel\Api\Client;

$publicApiKey = getenv('PUBLIC_KEY');
$privateApiKey = getenv('PRIVATE_KEY');

$client = new Client($privateApiKey, $publicApiKey);

$response = $client->get('characters', 1009351);

//Text to display for attribution requirements
$attributionText = $response->getDataWrapper()->getAttributionText();

$character = $response->getDataWrapper()->getData()->getResults()[0];

echo "{$character->getName()}\n";
echo "{$character->getDescription()}\n";

foreach ($character->getEvents()->getItems() as $event) {
    echo "\t{$event->getName()}\n";
}

Contact

Developers may be contacted at:

##Project Build With a checkout of the code get Composer in your PATH and run:

composer install
./vendor/bin/phpunit

With Great Power Comes Great Responsibility.

When using the marvel-api-client you must follow Marvel's Rules of Attribution