PHP code example of kozz / laravel-guzzle-provider

1. Go to this page and download the library: Download kozz/laravel-guzzle-provider library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kozz / laravel-guzzle-provider example snippets


    ...
    'providers' => [

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

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

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


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

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

$response = Guzzle::post(
    'https://httpbin.org/post',
    [
        'form_params' => [
            'id' => 222
        ]
    ]
);

$response = Guzzle::post(
    'https://httpbin.org/post',
    [
        'auth' => [ 'theUsername', 'thePassword'],
    ]
);