PHPackages                             caciobanu/guzzle-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. caciobanu/guzzle-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

caciobanu/guzzle-bundle
=======================

Integration bundle for guzzle with Symfony.

v1.1.1(7y ago)13.1kMITPHPPHP ^7.1

Since Jun 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/caciobanu/guzzle-bundle)[ Packagist](https://packagist.org/packages/caciobanu/guzzle-bundle)[ Docs](https://github.com/caciobanu/guzzle-bundle)[ RSS](/packages/caciobanu-guzzle-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

Guzzle Symfony Bundle
=====================

[](#guzzle-symfony-bundle)

This is a [Symfony](https://github.com/symfony/symfony) bundle that integrates [Guzzle](https://github.com/guzzle/guzzle) for easier use.

[![Build Status](https://camo.githubusercontent.com/ee6dcc8972503f13b287e9bfff9723e664512b9c1c86cf4e398b8eaf39565ff0/68747470733a2f2f7472617669732d63692e6f72672f636163696f62616e752f67757a7a6c652d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/caciobanu/guzzle-bundle)[![Code Coverage](https://camo.githubusercontent.com/583df0e888beafd2e592ce0f1ddebf72183922662a0787935b81c33a6ad7b81f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636163696f62616e752f67757a7a6c652d62756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/caciobanu/guzzle-bundle/?branch=master)

Installation
------------

[](#installation)

You can use [Composer](https://getcomposer.org/) to install the extension to your project:

```
composer require caciobanu/guzzle-bundle
```

Then create a minimal config file `caciobanu_guzzle.yml` in `config/packages/`:

```
caciobanu_guzzle:
    clients:
        google:
            base_uri: 'https://google.com'
```

A complete configuration looks like:

```
caciobanu_guzzle:
    clients:
        google:
            client_class: 'Your\Client'    # You must extend 'GuzzleHttp\Client' which is the default value.
            base_uri: 'https://google.com'
            logging: true                  # Enable logging. Default value: false.
            options:                       # See http://docs.guzzlephp.org/en/stable/request-options.html for all available options.
                timeout: 30
                headers:
                    'User-Agent': 'Test Agent'
```

Usage
-----

[](#usage)

Using services in controller:

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

Adding Guzzle middleware
------------------------

[](#adding-guzzle-middleware)

Adding a Guzzle middleware is a two step process:

1. Create a new class:

```
