Downloads
Stars
Version
A Laravel facade for GuzzleHttp Client.
Require this package, with Composer, in the root directory of your project.
$ composer require sanchescom/laravel-guzzle
After updating composer, add the ServiceProvider to the providers array in config/app.php
'providers' => [
...
Sanchescom\Guzzle\Providers\GuzzleServiceProvider::class,
],
After updating composer add the following lines to register provider in bootstrap/app.php
$app->register(Sanchescom\Guzzle\Providers\GuzzleServiceProvider::class);
<?php
use Sanchescom\Guzzle\Facades\Guzzle;
/**
* $statusCode = int(200)
*/
$statusCode = Guzzle::get('https://some.thing')->getStatusCode();
<?php
use Sanchescom\Guzzle\Facades\Guzzle;
$config = [
"base_uri" => "https://some.thing.new",
];
$data = [
"email" => "[email protected]",
];
/**
* $statusCode = int(201)
*/
$statusCode = Guzzle::config($config)->post('users', $data)->getStatusCode();