utkarshx/laravel-guzzle-provider

Guzzle Service Provider for Laravel 6

dev-master / 1.0.x-dev 2015-07-12 06:32 UTC

This package is not auto-updated.

Last update: 2024-12-11 11:42:22 UTC


README

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