codenix-sv / api-client
PHP API client
v1.0.0
2020-03-18 18:42 UTC
Requires
- php: >=7.2
- php-http/client-common: ^2.0
- php-http/discovery: ^1.7
- php-http/httplug: ^2.0
- php-http/message: ^1.8
- psr/cache: ^1.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- nyholm/psr7: ^1.2
- php-http/guzzle6-adapter: ^2.0
- php-http/mock-client: ^1.3
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-12-19 06:15:22 UTC
README
A simple API client, written with PHP that's easy to use.
Requirements
- PHP >= 7.2
- A HTTP client
- A PSR-7 implementation
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.