Looking to hire Laravel developers? Try LaraJobs

laravel-http-client maintained by nddcoder

Description
Guzzle Wrapper for laravel
Author
Last update
2019/04/18 16:10 (dev-master)
License
Links
Downloads
34

Comments
comments powered by Disqus

Guzzle Wrapper for laravel

Installation

You can install the package via composer:

composer require nddcoder/laravel-http-client

Usage

Inject HttpClient into Controller Contructor

use Nddcoder\HttpClient\HttpClient;

class TodoController extends Controller 
{
    private $http;

    public function __construct(HttpClient $http)
    {
        $this->http = $http;
    }

    public function index()
    {
        return $this->http->get('https://jsonplaceholder.typicode.com/todos');
        
        /*
            {
                "status_code": 200,
                "headers": {},
                "body": "...",
                "bodyJSON": [...]
            }
        */
    }
}

License

The MIT License (MIT). Please see License File for more information.