schenke-io / api-client
simple CURL based api client for applications without a SDK
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/schenke-io/api-client
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.