sanchescom / laravel-guzzle
Guzzle facade for laravel.
Installs: 1 993
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ~5.6|~7.0
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~5.0
Requires (Dev)
- phpunit/phpunit: ~4.0||~5.0||~6.0
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-10-26 21:54:08 UTC
README
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" => "some@thing.new", ]; /** * $statusCode = int(201) */ $statusCode = Guzzle::config($config)->post('users', $data)->getStatusCode();