Looking to hire Laravel developers? Try LaraJobs

laravel-guzzle-provider maintained by utkarshx

Description
Guzzle Service Provider for Laravel 6
Last update
2015/07/12 08:32 (dev-master)
License
Links
Downloads
8
Tags

Comments
comments powered by Disqus

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