Skip to content

Commit c9b90ab

Browse files
committed
docs: improved simple usage example
1 parent 6ef4e73 commit c9b90ab

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff 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
3939
use 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
}

0 commit comments

Comments
 (0)