schenke-io/api-client

simple CURL based api client for applications without a SDK

v0.4.0 2023-08-27 21:47 UTC

This package is auto-updated.

Last update: 2024-05-27 23:32:42 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

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.