/pokephp

A PHP Wrapper for the Pokemon API (pokeapi.co)

Primary LanguagePHPMIT LicenseMIT

PokePHP

A PHP Wrapper for the Pokemon API

Build Status StyleCI License Total Downloads Latest Stable Version

Getting Started

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.

Usage

Resource List

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');

Berries

Berries

You can pass a name or an id to receive the berry response

$api->berry('NAME OR ID');
Berry Firmnesses

You can pass a name or an id to receive the berry firmness

$api->berryFirmness('NAME OR ID');
Berry Flavor

You can pass a name or an id to receive the berry flavor

$api->berryFlavor('NAME OR ID');

Contests

Contest Types

You can pass a name or an id to receive the contest type

$api->contestType('NAME OR ID');
Contest Effect

You can pass an id to receive the contest effect

$api->contestEffect('ID');
Super Contest Effect

You can pass an id to receive the super contest effect

$api->superContestEffect('ID');

Encounters

Encounter Method

You can pass a name or an id to receive the encounter method

$api->encounterMethod('NAME OR ID');
Encounter Condition

You can pass a name or an id to receive the encounter condition

$api->encounterCondition('NAME OR ID');
Encounter Condition Values

You can pass a name or an id to receive the encounter condition value

$api->encounterConditionValue('NAME OR ID');

Evolution

Evolution Chain

You can pass an id to receive the evolution chain

$api->evolutionChain('ID');
Evolution Trigger

You can pass a name or an id to receive the evolution trigger

$api->evolutionTrigger('NAME OR ID');

Games

Game Generation

You can pass a name or an id to receive the game generation

$api->gameGeneration('NAME OR ID');
Pokedex

You can pass a name or an id to receive the pokedex

$api->pokedex('NAME OR ID');
Version

You can pass a name or an id to receive the game version

$api->version('NAME OR ID');
Version Group

You can pass a name or an id to receive the game version group

$api->versionGroup('NAME OR ID');

Items

Item

You can pass a name or an id to receive the item

$api->item('NAME OR ID');
Item Attribute

You can pass a name or an id to receive the item attribute

$api->itemAttribute('NAME OR ID');
Item Category

You can pass a name or an id to receive the item category

$api->itemCategory('NAME OR ID');
Item Fling Effect

You can pass a name or an id to receive the item fling effect

$api->itemFlingEffect('NAME OR ID');
Item Pocket

You can pass a name or an id to receive the item pocket

$api->itemPocket('NAME OR ID');

Moves

Move

You can pass a name or an id to receive the move

$api->move('NAME OR ID');
Move Ailment

You can pass a name or an id to receive the move ailment

$api->moveAilment('NAME OR ID');
Move Battle Style

You can pass a name or an id to receive the move battle style

$api->moveBattleStyle('NAME OR ID');
Move Category

You can pass a name or an id to receive the move category

$api->moveCategory('NAME OR ID');
Move Damage Class

You can pass a name or an id to receive the move damage class

$api->moveDamageClass('NAME OR ID');
Move Learn Method

You can pass a name or an id to receive the move learn method

$api->moveLearnMethod('NAME OR ID');
Move Target

You can pass a name or an id to receive the move target

$api->moveTarget('NAME OR ID');

Locations

Location

You can pass an id to receive the location

$api->location('ID');
Location Area

You can pass an id to receive the location area

$api->locationArea('ID');
Pal Park Areas

You can pass a name or an id to receive the Pal park areas

$api->palParkArea('NAME OR ID');
Reagion

You can pass a name or an id to receive the region

$api->region('NAME OR ID');

Pokemon

Abilities

You can pass a name or an id to receive the ability

$api->ability('NAME OR ID');
Characteristic

You can pass an id to receive the characteristic

$api->characteristic('ID');
Egg Group

You can pass a name or an id to receive the egg group

$api->eggGroup('NAME OR ID');
Gender

You can pass a name or an id to receive the gender

$api->gender('NAME OR ID');
Growth Rate

You can pass a name or an id to receive the growth rate

$api->growthRate('NAME OR ID');
Pokeathlon Stats

You can pass a name or an id to receive the Pokeathlon Stats

$api->pokeathlonStat('NAME OR ID');
Pokemon

You can pass a name or an id to receive the Pokemon

$api->pokemon('NAME OR ID');
Pokemon Color

You can pass a name or an id to receive the Pokemon Color

$api->pokemonColor('NAME OR ID');
Pokemon Form

You can pass a name or an id to receive the Pokemon Form

$api->pokemonForm('NAME OR ID');
Pokemon Habitat

You can pass a name or an id to receive the Pokemon Habitat

$api->pokemonHabitat('NAME OR ID');
Pokemon Shape

You can pass a name or an id to receive the Pokemon Shape

$api->pokemonShape('NAME OR ID');
Pokemon Species

You can pass a name or an id to receive the Pokemon Species

$api->pokemonSpecies('NAME OR ID');
Pokemon Stat

You can pass a name or an id to receive the Pokemon Stat

$api->pokemonStat('NAME OR ID');
Pokemon Type

You can pass a name or an id to receive the Pokemon Type

$api->pokemonType('NAME OR ID');

Utility

Language

You can pass a name or an id to receive the language

$api->language('NAME OR ID');

License

pokephp is open-sourced software licensed under the MIT license

Bug Reporting and Feature Requests

Please add as much detail as possible regarding the submission of issues and feature requests

Disclaimer

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.