PHPackages                             iarcadia/php-magic-pokeapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. iarcadia/php-magic-pokeapi

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

iarcadia/php-magic-pokeapi
==========================

An awesome PokéAPI PHP wrapper.

1.2.0(8y ago)135MITPHPPHP &gt;=7.1.7

Since Dec 14Pushed 8y agoCompare

[ Source](https://github.com/iArcadia/php-magic-pokeapi)[ Packagist](https://packagist.org/packages/iarcadia/php-magic-pokeapi)[ RSS](/packages/iarcadia-php-magic-pokeapi/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

MagicPokeAPI for PHP
--------------------

[](#magicpokeapi-for-php)

[![Packagist License](https://camo.githubusercontent.com/0fe57d9b4c072c3e63109fb36c2cbaffa1b8d8ad680fc7d0c2a327c1d0029a44/68747470733a2f2f706f7365722e707567782e6f72672f69617263616469612f7068702d6d616769632d706f6b656170692f6c6963656e73652e706e67)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/83b96aa5a6065d74de7e571e5e4e2265cd7ece630fdbe9b0a7ab8822f635b808/68747470733a2f2f706f7365722e707567782e6f72672f69617263616469612f7068702d6d616769632d706f6b656170692f76657273696f6e2e706e67)](https://packagist.org/packages/iarcadia/php-magic-pokeapi)[![Total Downloads](https://camo.githubusercontent.com/fbfbc04b8fffcf701d18dd01bee24e0498f930a30007c8424fd1ad8987c60ed0/68747470733a2f2f706f7365722e707567782e6f72672f69617263616469612f7068702d6d616769632d706f6b656170692f642f746f74616c2e706e67)](https://packagist.org/packages/iarcadia/php-magic-pokeapi)

This package is a POO-oriented PHP wrapper for using the **version 2** of the RESTful API [PokéAPI](https://pokeapi.co/). With MagicPokeAPI, you can obtain tons of data from PokéAPI server, thanks to some lines. The package includes an useful mini caching system.

What's PokéAPI?
---------------

[](#whats-pokéapi)

This is a full RESTful API linked to an extensive database detailing everything about the Pokémon main game series.

Installation
------------

[](#installation)

Require this package with composer:

```
composer require iarcadia/php-magic-pokeapi

```

Configuration
-------------

[](#configuration)

First of all, you need to check files into the `config` folder.

`cache.php` is cache systems related.

`request.php` is request systems related.

`lang.php` is language systems related.

Please, respect the comments written in these files.

Usage
-----

[](#usage)

### First step

[](#first-step)

Yep, you probably guess right: you have to create an instance of your favorite PokéAPI wrapper in order to continue.

```
$api = new PokeAPI();
```

Don't forget to `include` files or to `use` classes. (e.g. `use iArcadia\MagicPokeAPI\PokeAPI`)

### Second step

[](#second-step)

You must specify the resource that you want to look for! Use the `resource()` method.

```
$api->resource('pokemon');
// or (and the recommended one)
$api->resource(PokeAPI::RESOURCE_POKEMON);
```

The `PokeAPI` class provides constants for all resources. It could be a good idea to use them instead of direct string.

A constant list is available in `src/PokeAPI.php` file.

### Endpoints

[](#endpoints)

#### Setting the number of results (or "limit")

[](#setting-the-number-of-results-or-limit)

Use the `limit()` method.

```
$api->limit(20);
```

#### Setting the search starting point (or "offset")

[](#setting-the-search-starting-point-or-offset)

Use the `offset()` or the `skip()` method.

```
$api->offset(5);
// or
$api->skip(5);
```

The `skip()` method is an alias for the `offset()` one.

#### Executing the request

[](#executing-the-request)

Use the `get()` method.

```
$data = $api->get();
```

### Resource details

[](#resource-details)

Very simple, just use the `find()` method.

```
// by name
$item = $api->find('arcanine');
// or by id
$item = $api->find(25);
```

### Other

[](#other)

### Requesting raw URLs

[](#requesting-raw-urls)

You want to directly write your URL? Use the `raw()` method.

```
// endpoint
$api->raw('/ability/');
// with parameters
$api->raw('/pokemon-species/?limit=30&offset=60');
// resource details
$api->raw('/pokemon/bulbasaur/');
// with full URL
$api->raw('https://www.pokeapi.co/api/v2/item/203');
```

You can specify many URLs with an array, or with many arguments.

```
// array way
$api->raw(['/ability/', 'https://www.pokeapi.co/api/v2/item/203']);
// many args way
$api->raw('/ability/', 'https://www.pokeapi.co/api/v2/item/203');
```

Note that after using it, your `PokeAPI` object properties (url, resource, limit and offset) will be updated from your raw URL (or the last one if you specifies many URLs).

### Forcing the cache update

[](#forcing-the-cache-update)

If a reason, you want to force the update of a cached file, use the `cacheForcing()` method.

```
$api->cacheForcing(true);
```

It will update the cache for the next request ONLY.

Tips
----

[](#tips)

### Chaining methods

[](#chaining-methods)

Thanks to the power of the POO, you can quickly set up options between two different requests.

```
// for endpoint
$api->limit(20)->offset(60)->resource(PokeAPI::RESOURCE_ITEM)->get();
// for resource details
$api->resource(PokeAPI::RESOURCE_ITEM)->find('potion');
```

### Constructor options

[](#constructor-options)

If you prefer, you can also set up options at the instance creation (if you know that they won't change for example).

```
$api = new PokeApi(
[
    'limit' => 20,
    'offset' => 0, // works with "skip" too
    'resource' => PokeAPI::RESOURCE_CONTEST_EFFECT
]);
```

### Using automatic resource name translation

[](#using-automatic-resource-name-translation)

/!\\ CURRENTLY ONLY WORK WITH POKEMON NAME /!\\

If you decide to activate the automatic resource name translation (in the `config/lang.php` file), you will be able to use your language name for requesting data!

```
// Charizard in french will be translated to:
// $api->resource(PokeAPI::RESOURCE_POKEMON)->find('charizard');
$api->resource(PokeAPI::RESOURCE_POKEMON)->find('dracaufeu');

// Nidoqueen in korean will be translated to:
// $api->resource(PokeAPI::RESOURCE_POKEMON)->find('nidoqueen');
$api->resource(PokeAPI::RESOURCE_POKEMON)->find('니드퀸');
```

Bonus: even if you use this feature, all english will continue to work!

CHANGELOGS
----------

[](#changelogs)

See [CHANGELOGS.md](https://github.com/iArcadia/php-magic-pokeapi/blob/master/CHANGELOGS.md)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

3072d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.3

1.1.0PHP &gt;=7.1.7

### Community

Maintainers

![](https://www.gravatar.com/avatar/0cff9d129ded6d43ac69f8862744e7ed9359f39f3c2bb89c49d736c94a4b483a?d=identicon)[iArcadia](/maintainers/iArcadia)

---

Top Contributors

[![iArcadia](https://avatars.githubusercontent.com/u/25928721?v=4)](https://github.com/iArcadia "iArcadia (27 commits)")

---

Tags

phppokemonpokeapi

### Embed Badge

![Health badge](/badges/iarcadia-php-magic-pokeapi/health.svg)

```
[![Health](https://phpackages.com/badges/iarcadia-php-magic-pokeapi/health.svg)](https://phpackages.com/packages/iarcadia-php-magic-pokeapi)
```

###  Alternatives

[phing/phing

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.

1.2k21.7M876](/packages/phing-phing)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[altis/local-server

Local Server module for Altis

18208.4k2](/packages/altis-local-server)[nilportugues/php_todo

Looks into the code using a user-defined list of to-do phrases and stops commit if the total amount increased or is above a threshold.

1210.0k](/packages/nilportugues-php-todo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
