PHP code example of davidwofford / phppokeapi
1. Go to this page and download the library: Download davidwofford/phppokeapi library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
davidwofford / phppokeapi example snippets
$pokeApi = new \DavidWofford\PhpPokeApi\PhpPokeApi();
try {
$data = $pokeApi->fetchData($pokeApi::ENDPOINT_POKEMON, 'bulbasaur');
} catch (\Exception $e) {
// Handle the exception
}
$pokeApi = new \DavidWofford\PhpPokeApi\PhpPokeApi();
try {
$filters = [
'id',
'name'
];
$data = $pokeApi->fetchData($pokeApi::ENDPOINT_POKEMON, 'bulbasaur', $filters);
} catch (\Exception $e) {
// Handle the exception
}