brofist / json-api-client
A simple Json Api Client
Installs: 3 200
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.1
Requires (Dev)
- bro/code: ^0.1.5
- fabpot/php-cs-fixer: 1.7.*
- phpunit/phpunit: ~4.8.16
- satooshi/php-coveralls: dev-master
- symfony/console: ~2.7
This package is not auto-updated.
Last update: 2024-11-15 22:29:59 UTC
README
Simple wrapper for Guzzle.
Code information:
Scrutinizer
Package information:
Installing
Installing via Composer
Append the lib to your requirements key in your composer.json.
composer require brofist/json-api-client
Usage
use Brofist\ApiClient\Json; $client = new Json([ 'endpoint' => 'http://foo.bar/v1/blah', // optional 'basicAuth' => ['username', 'password'], ]); // basic usage: $resources = $client->get('/resources', [ 'limit' => 100, ]); $resources = $client->put('/resources/1', [ 'name' => 'foo', ]); $resources = $client->post('/resources', [ 'name' => 'foo', ]); // with optionally supplied custom options per-request: $resources = $client->post( '/resources', ['name' => 'foo'], ['headers' => ['X-Request-Token' => 'e4d909c290d0fb1ca068ffaddf22cbd0']] );
Issues/Features proposals
Here is the issue tracker.
Contributing
Only tested code will be accepted. Please follow fix the style guide.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
How to run the tests:
./vendor/bin/phpunit
To check the code standard run:
# Fixes code
./vendor/bin/bro-code fix src
./vendor/bin/bro-code fix tests
License
This software is distributed under the MIT license.