josh-hornby / http
A wrapper around the Guzzle Client API.
Installs: 2 098
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 0
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.0
- guzzlehttp/guzzle: 4.*
- illuminate/support: ~4.0
Requires (Dev)
- mockery/mockery: 0.9
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2017-05-30 21:30:04 UTC
README
Simple HTTP Requests
I personally find my self making lots of external API requests using Laravel. So I wrote a simple wrapper around the Guzzle API to make my life a little easier.
Install
Pull this package in through Composer.
composer require josh-hornby/http
You will also need to add just two things to your config/app.php
file, first add this to your providers array
'JoshHornby\Http\HttpServiceProvider'
And as this is a facade, add this to the aliases array
'Http' => 'JoshHornby\Http\HttpCore'
Usage
Http::get('http://myrequest.com');
Http::post('http://myrequest.com', ['postKey' => 'postValue' ]);
Http::put('http://myrequest.com', ['postKey' => 'postValue' ]);
Http::delete('http://myrequest.com');
Http::head('http://myrequest.com');
The package will check if it returns the correct status code (200 or 201) and present you with a nice JSON array. Simple!
Todo
- Unit testing
- Better header handling