https://github.com/codenix-sv/api-client
PHP API client
https://github.com/codenix-sv/api-client
api api-client api-client-php php psr-18 psr-7 simple-api simple-api-client
Last synced: about 1 month ago
JSON representation
PHP API client
- Host: GitHub
- URL: https://github.com/codenix-sv/api-client
- Owner: codenix-sv
- License: mit
- Created: 2020-03-18T18:36:20.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T18:45:15.000Z (about 5 years ago)
- Last Synced: 2025-02-27T08:27:49.240Z (about 2 months ago)
- Topics: api, api-client, api-client-php, php, psr-18, psr-7, simple-api, simple-api-client
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP API Client
[](https://travis-ci.org/codenix-sv/api-client)
[](https://scrutinizer-ci.com/g/codenix-sv/api-client/?branch=master)
[](https://codeclimate.com/github/codenix-sv/api-client/test_coverage)
[](https://codeclimate.com/github/codenix-sv/api-client/maintainability)
[](https://github.com/codenix-sv/api-client/blob/master/LICENSE)A simple API client, written with PHP that's easy to use.
## Requirements
* PHP >= 7.2
* A [HTTP client](https://packagist.org/providers/php-http/client-implementation)
* A [PSR-7 implementation](https://packagist.org/providers/psr/http-message-implementation)## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```bash
$ composer require codenix-sv/api-client
```
or add```json
"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:
```bash
$ composer require php-http/curl-client nyholm/psr7
```## Examples
*Send GET request*
```php
use Codenixsv\ApiClient\BaseClient;$client = new BaseClient();
$response = $client->get('https://httpbin.org/get');
```*Send POST request*
```php
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](./LICENSE) for details.