File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,28 +33,29 @@ require_once 'vendor/autoload.php';
3333
3434## Basic Usage
3535
36- Simple usage looks like :
36+ Just extend your API library with the ` Api ` class and have fun coding :
3737
3838``` php
3939use ProgrammatorDev\Api\Api;
40- use ProgrammatorDev\Api\Method;
4140
42- class PokeApi extends Api
41+ class YourApi extends Api
4342{
4443 public function __construct()
4544 {
4645 parent::__construct();
4746
48- $this->setBaseUrl('https://pokeapi.co/api/v2');
47+ // minimum required config
48+ $this->setBaseUrl('https://api.example.com/v1');
4949 }
5050
51- public function getPokemon (int|string $idOrName ): string
51+ public function getRecords (int $page = 1 ): string
5252 {
5353 return $this->request(
54- method: Method::GET,
55- path: $this->buildPath('/pokemon/{idOrName}', [
56- 'idOrName' => $idOrName
57- ])
54+ method: 'GET',
55+ path: '/records',
56+ query: [
57+ 'page' => $page
58+ ]
5859 );
5960 }
6061}
You can’t perform that action at this time.
0 commit comments