schenke-io / api-client
simple CURL based api client for applications without a SDK
v0.4.0
2023-08-27 21:47 UTC
Requires
- php: ^8.1
- ext-curl: *
Requires (Dev)
- laravel/pint: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^10.1
README
simple CURL based api client for applications without a SDK
Installation
composer require schenke-io/api-client
Usage
Build a local class which extends BaseClient
or BaseJsonClient
.
#app/MyClass.php class MyClass extends BaseClient { public function getAuthHeader(): array { return [ 'Authorization: Bearer <YOUR-TOKEN>' ]; } }
Then use this class like this:
#app/MyClass.php $api = new MyClass('https://example.com/api/v2/'); $result = $api->get('/users'); print_r($result);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.