This package is abandoned and no longer maintained. No replacement package was suggested.

A wrapper around the Guzzle Client API.

0.5.1 2017-05-30 21:27 UTC

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