utkarshx/laravel-guzzle-provider

Guzzle Service Provider for Laravel 6
8
Install
composer require utkarshx/laravel-guzzle-provider
PHP:>=5.5.0
License:MIT
Last Updated:Jul 12, 2015
Links: GitHub  ·  Packagist
Maintainer: utkarshx

Laravel - Guzzle 6 (or 5) Service Provider

laravel guzzle service provider

Install With Composer:

Guzzle ~5.0

composer require utkarshx/laravel-guzzle-provider ~6.0

Or manualy in composer.json:

"require": {
    "utkarshx/laravel-guzzle-provider": "~5.0"
}

Guzzle ~6.0

composer require utkarshx/laravel-guzzle-provider ~6.0

Or manualy in composer.json:

"require": {
    "utkarshx/laravel-guzzle-provider": "~6.0"
}

Register Service Provider

/configs/app.php

    ...
    'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        ...

        /*
         * Application Service Providers...
         */
        ...
        'Utkarshx\Laravel\Providers\Guzzle'
    ],

Enable Facade

/configs/app.php

    ...
    'aliases' => [
        ...
        'Guzzle' => 'Utkarshx\Laravel\Facades\Guzzle'
    ],

Usage

Send request


  $response = \Guzzle::get('https://google.com');

Get instance

    $client = app()->offsetGet('guzzle');
    $client = \Illuminate\Container\Container::getInstance()->offsetGet('guzzle');
    $client = \Utkarshx\Laravel\Facades\Guzzle::getFacadeRoot();
    $client = \Guzzle::getFacadeRoot();