PHP code example of caciobanu / guzzle-bundle

1. Go to this page and download the library: Download caciobanu/guzzle-bundle 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/ */

    

caciobanu / guzzle-bundle example snippets


/** @var \GuzzleHttp\Client $client */
$client   = $this->get('caciobanu_guzzle.client.google');
$response = $client->get('/');



namespace App\Guzzle\Middleware;

use Caciobanu\Symfony\GuzzleBundle\Middleware\BeforeRequestMiddlewareInterface;
use Psr\Http\Message\RequestInterface;

class MyMiddleware implements BeforeRequestMiddlewareInterface
{
    public function __invoke(RequestInterface $request): RequestInterface
    {
        // Do something with the request
        return $request;
    }
}