chronoarc/marvel
最新稳定版本:0.0.2-alpha.1
Composer 安装命令:
composer require chronoarc/marvel
包简介
A PHP wrapper for Marvel's API
README 文档
README
Unfortunately, this project will remain unfinished. 😿
The Marvel Developer Portal has Sunset as of Wednesday, October 29, 2025. As such, we are no longer accepting new sign-ups for a Marvel Comics API key.
🦸 Marvel PHP SDK
Welcome to the Marvel PHP SDK, a lightweight and easy-to-use SDK designed to interact with the Marvel API, built on top of the robust Saloon library.
🚧 Progress
- Use enums for query parameters:
- Comic:
OrderByin query paramsFormatin query params and dtoFormatTypein query params
- Character
- Events
- Stories
- Creators
- Series
- Comic:
- Convert all dates to
DateTimeobjects - Tests
- Submit to Packagist
🚀 Getting Started
Installation
You can install the SDK via Composer:
composer require chronoarc/marvel
Usage
require 'vendor/autoload.php'; $publicKey = 'your-public-key-here'; $privateKey = 'your-private-key-here'; $marvel = new Chronoarc\Marvel\Marvel($publicKey, $privateKey); $superhero = ['name' => 'Spider-Man (Peter Parker)', 'id' => 1009610]; $characters = $marvel->characters()->search(name: $superhero['name']); $characters->dto(); // Chronoarc\Marvel\Dto\CharacterDataWrapper $character = $marvel->characters()->getCharacter($superhero['id']); $character->dto(); // Chronoarc\Marvel\Dto\CharacterDataWrapper $characterSeries = $marvel->characters()->getCharacterSeries($superhero['id']); $characterSeries->dto(); // Chronoarc\Marvel\Dto\SeriesDataWrapper $characterComics = $marvel->characters()->getCharacterComics($superhero['id']); $characterComics->dto(); // Chronoarc\Marvel\Dto\ComicDataWrapper $characterEvents = $marvel->characters()->getCharacterEvents($superhero['id']); $characterEvents->dto(); // Chronoarc\Marvel\Dto\EventDataWrapper $characterStories = $marvel->characters()->getCharacterStories($superhero['id']); $characterStories->dto(); // Chronoarc\Marvel\Dto\StoryDataWrapper
Advanced
Additionally, you can use the provided enums for query parameters:
use Chronoarc\Marvel\Enums\Comic\OrderBy; use Chronoarc\Marvel\Enums\Comic\Format; ... /** @var ComicDataWrapper $comics */ $comics = $this->connector->comics()->search( format: Format::comic, orderBy: [OrderBy::titleAsc], )->dto();
Note: DTOs also have enums for their properties, so you can use them to access the data in a more predictable way.
🤝 Contributions Welcome
Your feedback and contributions are highly appreciated! Whether it’s submitting an issue, suggesting improvements, or adding new features, every bit helps make this SDK better for everyone.
Feel free to fork the repository, make pull requests, or just share ideas! Let's make this SDK awesome together.
📝 License
MIT
ChronoArc
This SDK is made for ChronoArc, an app I am trying to build an app that lets you create reading guides, subscribe to already created guides, and track your progress towards reading a specific guide.
There's another SDK that uses Comicvine API, which is also part of the ChronoArc project. You can check it out at chronoarc/comicvine-sdk.
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-07
