codenix-sv/api-client

v1.0.0 2020-03-18 18:42 UTC

This package is auto-updated.

Last update: 2024-12-19 06:15:22 UTC


README

Build Status Scrutinizer Code Quality Test Coverage Maintainability License: MIT

A simple API client, written with PHP that's easy to use.

Requirements

Installation

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

Examples

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');

License

codenix-sv/api-client is released under the MIT License. See the bundled LICENSE for details.