utkarshx / laravel-guzzle by utkarshx

Guzzle Service Provider for Laravel 6
8
0
3
Package Data
Maintainer Username: utkarshx
Maintainer Contact: utk.shukla@gmail.com (Utkarsh Shukla)
Package Create Date: 2015-07-12
Package Last Update: 2015-07-12
Language: PHP
License: MIT
Last Refreshed: 2024-11-18 03:05:09
Package Statistics
Total Downloads: 8
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 3
Total Forks: 0
Total Open Issues: 0

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