A simple API client, written with PHP that's easy to use.
- PHP >= 7.2
- A HTTP client
- A PSR-7 implementation
The preferred way to install this extension is through composer.
Either run
$ composer require codenix-sv/api-client
or add
"codenix-sv/api-client": "^1.0"
to the require section of your application's composer.json
file.
Make sure you have installed a PSR-18 HTTP Client and PSR-7 message implementation before you install this package. For example:
$ composer require php-http/curl-client nyholm/psr7
Send GET request
use Codenixsv\ApiClient\BaseClient;
$client = new BaseClient();
$response = $client->get('https://httpbin.org/get');
Send POST request
use Codenixsv\ApiClient\BaseClient;
$client = new BaseClient();
$response = $client->post('https://httpbin.org/post', 'foo=bar');
codenix-sv/api-client
is released under the MIT License. See the bundled LICENSE for details.