A PHP Wrapper for the Pokemon API
To get started you must first install the package from composer.
composer require danrovito/pokephp
After composer installs the required package you can call the class by setting the following:
use PokePHP\PokeApi;
$api = new PokeApi;
This will give you the instance of the class to call the API functions. Below you will see examples for each endpoint. I utilize the $api
variable we created above to call each function.
Calling any API endpoint without a resource ID or name will return a paginated list of available resources for that API call. You can read more about resource list usage here. The Limit and Offset parameters are optional.
$api->resourceList('ENDPOINT', 'LIMIT', 'OFFSET');
You can pass a name
or an id
to receive the berry response
$api->berry('NAME OR ID');
You can pass a name
or an id
to receive the berry firmness
$api->berryFirmness('NAME OR ID');
You can pass a name
or an id
to receive the berry flavor
$api->berryFlavor('NAME OR ID');
You can pass a name
or an id
to receive the contest type
$api->contestType('NAME OR ID');
You can pass an id
to receive the contest effect
$api->contestEffect('ID');
You can pass an id
to receive the super contest effect
$api->superContestEffect('ID');
You can pass a name
or an id
to receive the encounter method
$api->encounterMethod('NAME OR ID');
You can pass a name
or an id
to receive the encounter condition
$api->encounterCondition('NAME OR ID');
You can pass a name
or an id
to receive the encounter condition value
$api->encounterConditionValue('NAME OR ID');
You can pass an id
to receive the evolution chain
$api->evolutionChain('ID');
You can pass a name
or an id
to receive the evolution trigger
$api->evolutionTrigger('NAME OR ID');
You can pass a name
or an id
to receive the game generation
$api->gameGeneration('NAME OR ID');
You can pass a name
or an id
to receive the pokedex
$api->pokedex('NAME OR ID');
You can pass a name
or an id
to receive the game version
$api->version('NAME OR ID');
You can pass a name
or an id
to receive the game version group
$api->versionGroup('NAME OR ID');
You can pass a name
or an id
to receive the item
$api->item('NAME OR ID');
You can pass a name
or an id
to receive the item attribute
$api->itemAttribute('NAME OR ID');
You can pass a name
or an id
to receive the item category
$api->itemCategory('NAME OR ID');
You can pass a name
or an id
to receive the item fling effect
$api->itemFlingEffect('NAME OR ID');
You can pass a name
or an id
to receive the item pocket
$api->itemPocket('NAME OR ID');
You can pass a name
or an id
to receive the move
$api->move('NAME OR ID');
You can pass a name
or an id
to receive the move ailment
$api->moveAilment('NAME OR ID');
You can pass a name
or an id
to receive the move battle style
$api->moveBattleStyle('NAME OR ID');
You can pass a name
or an id
to receive the move category
$api->moveCategory('NAME OR ID');
You can pass a name
or an id
to receive the move damage class
$api->moveDamageClass('NAME OR ID');
You can pass a name
or an id
to receive the move learn method
$api->moveLearnMethod('NAME OR ID');
You can pass a name
or an id
to receive the move target
$api->moveTarget('NAME OR ID');
You can pass an id
to receive the location
$api->location('ID');
You can pass an id
to receive the location area
$api->locationArea('ID');
You can pass a name
or an id
to receive the Pal park areas
$api->palParkArea('NAME OR ID');
You can pass a name
or an id
to receive the region
$api->region('NAME OR ID');
You can pass a name
or an id
to receive the ability
$api->ability('NAME OR ID');
You can pass an id
to receive the characteristic
$api->characteristic('ID');
You can pass a name
or an id
to receive the egg group
$api->eggGroup('NAME OR ID');
You can pass a name
or an id
to receive the gender
$api->gender('NAME OR ID');
You can pass a name
or an id
to receive the growth rate
$api->growthRate('NAME OR ID');
You can pass a name
or an id
to receive the Pokeathlon Stats
$api->pokeathlonStat('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon
$api->pokemon('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon Color
$api->pokemonColor('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon Form
$api->pokemonForm('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon Habitat
$api->pokemonHabitat('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon Shape
$api->pokemonShape('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon Species
$api->pokemonSpecies('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon Stat
$api->pokemonStat('NAME OR ID');
You can pass a name
or an id
to receive the Pokemon Type
$api->pokemonType('NAME OR ID');
You can pass a name
or an id
to receive the language
$api->language('NAME OR ID');
pokephp is open-sourced software licensed under the MIT license
Please add as much detail as possible regarding the submission of issues and feature requests
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.