PHPackages                             gregurco/guzzle-bundle-cache-plugin - 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. [Framework](/categories/framework)
4. /
5. gregurco/guzzle-bundle-cache-plugin

ActiveLibrary[Framework](/categories/framework)

gregurco/guzzle-bundle-cache-plugin
===================================

Cache Plugin for Guzzle Bundle, a PHP HTTP client library and framework for building RESTful web service clients

v3.1.0(2y ago)11372.1k—5.6%71MITPHPPHP &gt;=7.2

Since Oct 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/gregurco/GuzzleBundleCachePlugin)[ Packagist](https://packagist.org/packages/gregurco/guzzle-bundle-cache-plugin)[ Docs](https://github.com/gregurco/GuzzleBundleCachePlugin)[ RSS](/packages/gregurco-guzzle-bundle-cache-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (12)Used By (1)

Guzzle Bundle Cache Plugin
==========================

[](#guzzle-bundle-cache-plugin)

[![Build Status](https://camo.githubusercontent.com/c39dd8690d3252ce75f73bcda8e52e4dd35626196d1403f31d84e5871c03ea79/68747470733a2f2f7472617669732d63692e6f72672f677265677572636f2f47757a7a6c6542756e646c654361636865506c7567696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gregurco/GuzzleBundleCachePlugin)[![Coverage Status](https://camo.githubusercontent.com/7770ffa869bbb6ebc8d757f42c197735667033bec4bfc7a4a2f454fec521cc53/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f677265677572636f2f47757a7a6c6542756e646c654361636865506c7567696e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/gregurco/GuzzleBundleCachePlugin)[![SensioLabsInsight](https://camo.githubusercontent.com/be29895e92b3ea492bafc4fc78a678765a23eb5a0d32d06b5e1dda3e45d95ae9/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30383430306262332d353430642d343631362d623062332d6636393461373361373263662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/08400bb3-540d-4616-b0b3-f694a73a72cf)

This plugin integrates cache functionality into Guzzle Bundle, a bundle for building RESTful web service clients.

Requirements
------------

[](#requirements)

- PHP 7.2 or above
- [Guzzle Bundle](https://github.com/8p/EightPointsGuzzleBundle)
- [Guzzle Cache middleware](https://github.com/Kevinrob/guzzle-cache-middleware)

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

[](#installation)

Using [composer](https://getcomposer.org/):

##### composer.json

[](#composerjson)

```
{
    "require": {
        "gregurco/guzzle-bundle-cache-plugin": "dev-master"
    }
}
```

##### command line

[](#command-line)

```
$ composer require gregurco/guzzle-bundle-cache-plugin
```

Usage
-----

[](#usage)

### Enable bundle

[](#enable-bundle)

#### Symfony 2.x and 3.x

[](#symfony-2x-and-3x)

Plugin will be activated/connected through bundle constructor in `app/AppKernel.php`, like this:

```
new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle([
    new Gregurco\Bundle\GuzzleBundleCachePlugin\GuzzleBundleCachePlugin(),
])
```

#### Symfony 4

[](#symfony-4)

The registration of bundles was changed in Symfony 4 and now you have to change `src/Kernel.php` to achieve the same functionality.
Find next lines:

```
foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        yield new $class();
    }
}
```

and replace them by:

```
foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        if ($class === \EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class) {
            yield new $class([
                new \Gregurco\Bundle\GuzzleBundleCachePlugin\GuzzleBundleCachePlugin(),
            ]);
        } else {
            yield new $class();
        }
    }
}
```

### Basic configuration

[](#basic-configuration)

```
# app/config/config.yml

eight_points_guzzle:
    clients:
        api_payment:
            base_url: "http://api.domain.tld"

            # define headers, options

            # plugin settings
            plugin:
                cache:
                    enabled: true
```

### Configuration with specific cache strategy

[](#configuration-with-specific-cache-strategy)

```
# app/config/services.yml

services:
    acme.filesystem_cache:
        class: Doctrine\Common\Cache\FilesystemCache
        arguments: ['/tmp/']
        public: false

    acme.doctrine_cache_storage:
        class: Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage
        arguments: ['@acme.filesystem_cache']
        public: false

    acme.private_cache_strategy:
        class: Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy
        arguments: ['@acme.doctrine_cache_storage']
        public: false
```

```
# app/config/config.yml

eight_points_guzzle:
    clients:
        api_payment:
            plugin:
                cache:
                    enabled: true
                    strategy: "acme.private_cache_strategy"
```

More information about cache strategies can be found here: [Kevinrob/guzzle-cache-middleware](https://github.com/Kevinrob/guzzle-cache-middleware)

### Invalidate cache

[](#invalidate-cache)

```
# get client
$apiPaymentClient = $this->get('eight_points_guzzle.client.api_payment');

# do a request
$apiPaymentClient->request('GET', 'ping');

# invalidate cache
$event = new InvalidateRequestEvent($apiPaymentClient, 'GET', 'ping');
$this->get('event_dispatcher')->dispatch(GuzzleBundleCacheEvents::INVALIDATE, $event);
```

License
-------

[](#license)

This middleware is licensed under the MIT License - see the LICENSE file for details

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 93.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~233 days

Recently: every ~135 days

Total

11

Last Release

797d ago

Major Versions

v1.0.4 → v2.0.02020-07-13

v2.3.0 → v3.0.02023-01-26

PHP version history (3 changes)v1.0.0PHP ^7.0

v2.1.0PHP ^7.0 || ^8.0

v3.1.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/e6e4e1affdc07c2a6f474612be36cf3e0532b9f4cf7ce022faa7ecf3504dfc65?d=identicon)[gregurco](/maintainers/gregurco)

---

Top Contributors

[![gregurco](https://avatars.githubusercontent.com/u/4052904?v=4)](https://github.com/gregurco "gregurco (28 commits)")[![dsentker24](https://avatars.githubusercontent.com/u/97023595?v=4)](https://github.com/dsentker24 "dsentker24 (1 commits)")[![Neirda24](https://avatars.githubusercontent.com/u/7036794?v=4)](https://github.com/Neirda24 "Neirda24 (1 commits)")

---

Tags

bundlecacheguzzleguzzle-bundle-pluginguzzle-middlewarephpsymfonysymfony-bundlehttpmiddlewarepluginclientframeworkrestcurlhttp clientweb servicecache

### Embed Badge

![Health badge](/badges/gregurco-guzzle-bundle-cache-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/gregurco-guzzle-bundle-cache-plugin/health.svg)](https://phpackages.com/packages/gregurco-guzzle-bundle-cache-plugin)
```

###  Alternatives

[gregurco/guzzle-bundle-oauth2-plugin

OAuth2 Plugin for Guzzle Bundle, a PHP HTTP client library and framework for building RESTful web service clients

13348.3k](/packages/gregurco-guzzle-bundle-oauth2-plugin)[eightpoints/guzzle-wsse-middleware

WSSE Middleware for Guzzle, a PHP HTTP client library and framework for building RESTful web service clients

312.1M5](/packages/eightpoints-guzzle-wsse-middleware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
