chronoarc / marvel
A PHP wrapper for Marvel's API
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/chronoarc/marvel
Requires
- php: >=8.2
- saloonphp/saloon: ^v3.10
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- pestphp/pest: ^3.5
- symfony/var-dumper: ^7.1
This package is auto-updated.
Last update: 2025-12-19 08:37:03 UTC
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.
