LaravelPackages.net
Acme Inc.
Toggle sidebar
sanchescom/laravel-guzzle

Guzzle facade for laravel.

1.994
1
0.1.0
About sanchescom/laravel-guzzle

sanchescom/laravel-guzzle is a Laravel package for guzzle facade for laravel.. It currently has 1 GitHub stars and 1.994 downloads on Packagist (latest version 0.1.0). Install it with composer require sanchescom/laravel-guzzle. Discover more Laravel packages by sanchescom or browse all Laravel packages to compare alternatives.

Last updated

Laravel guzzle

A Laravel facade for GuzzleHttp Client.

Installing

Require this package, with Composer, in the root directory of your project.

$ composer require sanchescom/laravel-guzzle

Laravel 5.x:

After updating composer, add the ServiceProvider to the providers array in config/app.php

'providers' => [
   ...
   Sanchescom\Guzzle\Providers\GuzzleServiceProvider::class,
],

Lumen:

After updating composer add the following lines to register provider in bootstrap/app.php

$app->register(Sanchescom\Guzzle\Providers\GuzzleServiceProvider::class);

Usage

GET Status code

<?php

use Sanchescom\Guzzle\Facades\Guzzle;

/**
 * $statusCode = int(200)
 */
$statusCode = Guzzle::get('https://some.thing')->getStatusCode();

POST with custom config

<?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();

Star History Chart