PHP code example of lmerotta / phpokeapi

1. Go to this page and download the library: Download lmerotta/phpokeapi 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/ */

    

lmerotta / phpokeapi example snippets




use PokeAPI\Client;

$client = new Client();

// Returns a PokeAPI\Pokemon\Species instance
$species = $client->species('bulbasaur'); // or $client->species(1);




// ...

$species->getName(); // 'bulbasaur'
$growthRate = $species->getGrowthRate(); // A proxy of PokeAPI\Pokemon\GrowthRate 

$growthRate->getName(); // Here the real API call to the GrowthRate endpoint is made