https://github.com/alecoletti/http
A simple wrapper based around the Guzzle API.
https://github.com/alecoletti/http
Last synced: 13 days ago
JSON representation
A simple wrapper based around the Guzzle API.
- Host: GitHub
- URL: https://github.com/alecoletti/http
- Owner: alecoletti
- License: mit
- Created: 2014-10-23T10:16:10.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-10-23T10:20:02.000Z (over 11 years ago)
- Last Synced: 2023-03-25T12:57:58.746Z (about 3 years ago)
- Size: 108 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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.
```js
{
"require": {
"josh-hornby/http": "0.4.*"
}
}
```
You will also need to add just two things to your ```config/app.php``` file, first add this to your ***providers*** array
```php
'JoshHornby\Http\HttpServiceProvider'
```
And as this is a facade, add this to the ***aliases*** array
```php
'Http' => 'JoshHornby\Http\HttpCore'
```
## Usage
```php
Http::get('http://myrequest.com');
```
```php
Http::post('http://myrequest.com', ['postKey' => 'postValue' ]);
```
```php
Http::put('http://myrequest.com', ['postKey' => 'postValue' ]);
```
```php
Http::delete('http://myrequest.com');
```
```php
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