chadicus / marvel-api-client
Marvel API 的 PHP 客户端
v3.0.1
2018-01-28 16:35 UTC
Requires
- php: ^7.0
- chadicus/psr-cache-helper: ^0.2.1
- chadicus/spl-exceptions: ^1.0
- chadicus/spl-types: ^1.0
- dominionenterprises/filter: 2.1
- dominionenterprises/util: ^2.0
- guzzlehttp/guzzle: ^6.2
- psr/simple-cache: ^1.0
Requires (Dev)
- chadicus/coding-standard: ^1.3
- chadicus/test-helpers: ^1.0
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^6.0
Suggests
- chadicus/psr-cache-mongodb: Adds response caching with mongodb
This package is auto-updated.
Last update: 2024-09-19 21:39:52 UTC
README
用于 Marvel API 的 PHP 客户端。
需求
Marvel API 客户端需要 PHP 7.0(或更高版本)。
Composer
要作为本地项目依赖项添加库,请使用 Composer!只需将 chadicus/marvel-api-client
作为依赖项添加到项目的 composer.json
文件中,例如
composer require chadicus/marvel-api-client
示例
使用示例可以在 这里 找到
基本用法
<?php require_once __DIR__ . '/vendor/autoload.php'; use Chadicus\Marvel\Api\Client; $publicApiKey = 'YOUR PUBLIC API KEY'; $privateApiKey = 'YOUR PRIVATE API KEY'; $client = new Client($privateApiKey, $publicApiKey); $dataWrapper = $client->get('characters', 1009351); //Text to display for attribution requirements $attributionText = $dataWrapper->getAttributionText(); $character = $dataWrapper->getData()->getResults()[0]; echo "{$character->getName()}\n"; echo "{$character->getDescription()}\n"; foreach ($character->getEvents()->getItems() as $event) { echo "\t{$event->getName()}\n"; }
社区
联系方式
开发者可以通过以下方式联系
项目构建
检出代码后,在您的 PATH 中获取 Composer 并运行
composer install ./vendor/bin/phpunit
能力越大,责任越大。
在使用 marvel-api-client
时,您必须遵守 Marvel 的归属规则