Download the PHP package iarcadia/php-magic-pokeapi without Composer
On this page you can find all versions of the php package iarcadia/php-magic-pokeapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-magic-pokeapi
MagicPokeAPI for PHP
This package is a POO-oriented PHP wrapper for using the version 2 of the RESTful API PokéAPI. 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?
This is a full RESTful API linked to an extensive database detailing everything about the Pokémon main game series.
Installation
Require this package with composer:
Configuration
First of all, you need to check files into the folder.
is cache systems related.
is request systems related.
is language systems related.
Please, respect the comments written in these files.
Usage
First step
Yep, you probably guess right: you have to create an instance of your favorite PokéAPI wrapper in order to continue.
Don't forget to files or to classes. (e.g. )
Second step
You must specify the resource that you want to look for! Use the method.
The 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 file.
Endpoints
Setting the number of results (or "limit")
Use the method.
Setting the search starting point (or "offset")
Use the or the method.
The method is an alias for the one.
Executing the request
Use the method.
Resource details
Very simple, just use the method.
Other
Requesting raw URLs
You want to directly write your URL? Use the method.
You can specify many URLs with an array, or with many arguments.
Note that after using it, your 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
If a reason, you want to force the update of a cached file, use the method.
It will update the cache for the next request ONLY.
Tips
Chaining methods
Thanks to the power of the POO, you can quickly set up options between two different requests.
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).
Using automatic resource name translation
/!\ CURRENTLY ONLY WORK WITH POKEMON NAME /!\
If you decide to activate the automatic resource name translation (in the file), you will be able to use your language name for requesting data!
Bonus: even if you use this feature, all english will continue to work!
CHANGELOGS
See CHANGELOGS.md