nddcoder / laravel-http-client
Guzzle Wrapper for laravel
v1.2.0
2019-04-18 14:10 UTC
Requires
- guzzlehttp/guzzle: 6.3.*
This package is auto-updated.
Last update: 2024-10-19 02:57:11 UTC
README
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.