PHPackages                             thecodingmachine/symfony-cache-universal-module - 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. [Caching](/categories/caching)
4. /
5. thecodingmachine/symfony-cache-universal-module

ActiveLibrary[Caching](/categories/caching)

thecodingmachine/symfony-cache-universal-module
===============================================

Cross-framework module for Symfony cache

16012PHP

Since Aug 19Pushed 7y ago6 watchersCompare

[ Source](https://github.com/thecodingmachine/symfony-cache-universal-module)[ Packagist](https://packagist.org/packages/thecodingmachine/symfony-cache-universal-module)[ RSS](/packages/thecodingmachine-symfony-cache-universal-module/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/bb28e15a5dd92089507428072a874994cd5922f868b391beccf4e8b4309257d6/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f73796d666f6e792d63616368652d756e6976657273616c2d6d6f64756c652f762f737461626c65)](https://packagist.org/packages/thecodingmachine/symfony-cache-universal-module)[![Latest Unstable Version](https://camo.githubusercontent.com/51664392e767659603a5c0dc39532abe3e3af72171c2e77f6521e84ee00b8b99/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f73796d666f6e792d63616368652d756e6976657273616c2d6d6f64756c652f762f756e737461626c65)](https://packagist.org/packages/thecodingmachine/symfony-cache-universal-module)[![License](https://camo.githubusercontent.com/c7877f124534c24d47d96341468b5b07643c4220077482666cf5066fb8deb33b/68747470733a2f2f706f7365722e707567782e6f72672f746865636f64696e676d616368696e652f73796d666f6e792d63616368652d756e6976657273616c2d6d6f64756c652f6c6963656e7365)](https://packagist.org/packages/thecodingmachine/symfony-cache-universal-module)[![Build Status](https://camo.githubusercontent.com/f96ec701d5b6ce3f33b62dbba1b018036201c31a167b93725737ec351f1bd6fd/68747470733a2f2f7472617669732d63692e6f72672f746865636f64696e676d616368696e652f73796d666f6e792d63616368652d756e6976657273616c2d6d6f64756c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/thecodingmachine/symfony-cache-universal-module)[![Coverage Status](https://camo.githubusercontent.com/8cb8604771213d7531a0d4a4dc9a77432180e61cdb450300ed660c30351fb9ae/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f746865636f64696e676d616368696e652f73796d666f6e792d63616368652d756e6976657273616c2d6d6f64756c652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/thecodingmachine/symfony-cache-universal-module?branch=master)

Symfony cache universal module
==============================

[](#symfony-cache-universal-module)

This package integrates the Symfoncy Cache component in any [container-interop](https://github.com/container-interop/service-provider) compatible framework/container.

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

[](#installation)

```
$ composer require thecodingmachine/symfony-cache-universal-module
```

Once installed, you need to register the [`TheCodingMachine\SymfonyCacheServiceProvider`](src/SymfonyCacheServiceProvider.php) into your container.

If your container supports [thecodingmachine/discovery](https://github.com/thecodingmachine/discovery) integration, you have nothing to do. Otherwise, refer to your framework or container's documentation to learn how to register *service providers*.

Introduction
------------

[](#introduction)

This service provider is meant to create both PSR-16 caches `Psr\SimpleCache\CacheInterface` and PSR-6 cache pools `Psr\Cache\CacheItemPoolInterface` instance.

Out of the box, the instance should be usable with sensible defaults. We tried to keep the defaults usable for most of the developer, while still providing best performances for the server:

- the provided caches are made of chainable caches
- the first level is an ArrayCache (in-memory) for fast access to already fetched values
- the second level is an APCu cache, with a *PhpFilesCache* fallback if the APCu extension is not available.

Note: the Symfony cache component provides a lot of adapters for a lot of platforms. This service provider does not attempt to map all the caches provided but instead focuses on sane defaults.

### PSR-16 Usage

[](#psr-16-usage)

```
use Psr\SimpleCache\CacheInterface

$cache = $container->get(CacheInterface::class);
echo $cachePool->get('my_cached_value');
```

### PSR-6 Usage

[](#psr-6-usage)

```
use Psr\Cache\CacheItemPoolInterface

$cachePool = $container->get(CacheItemPoolInterface::class);
echo $cachePool->getItem('my_cached_value')->get();
```

Expected values / services
--------------------------

[](#expected-values--services)

This *service provider* expects the following configuration / services to be available:

NameCompulsoryDescription`symfony.cache.namespace`*no*The namespace for the cache. Defaults to ''.`symfony.cache.defaultLifetime`*no*The default life time for the cache. Defaults to 0 (no limit).`symfony.cache.version`*no*The version of the cache (if changed, the cache is purged)`symfony.cache.files.directory`*no*The directory where cached files will be stored. Defaults to a directory in the temporary system directory.Provided services
-----------------

[](#provided-services)

This *service provider* provides the following services:

Service nameDescription`CacheInterface::class`Alias to `ChainCache::class``ChainCache::class`A composite cache that chains calls to several cache backend`symfony.cache.chained.caches`The list of chained caches used by the `ChainCache::class` instance. This value is a `SplPriorityQueue` that can be extended easily.`ArrayCache::class`An in-memory cache`NullCache::class`A cache that caches nothing`ApcuCache::class`A cache with an APCu backend`PhpFilesCache::class`A cache with PHP files as backend`CacheItemPoolInterface::class`Alias to `SimpleCacheAdapter::class``SimpleCacheAdapter::class`A PSR-6 =&gt; PSR-16 adapter.Project template courtesy of [thecodingmachine/service-provider-template](https://github.com/thecodingmachine/service-provider-template)

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

![](https://avatars.githubusercontent.com/u/1847918?v=4)[TheCodingMachine](/maintainers/thecodingmachine)[@thecodingmachine](https://github.com/thecodingmachine)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (4 commits)")

### Embed Badge

![Health badge](/badges/thecodingmachine-symfony-cache-universal-module/health.svg)

```
[![Health](https://phpackages.com/badges/thecodingmachine-symfony-cache-universal-module/health.svg)](https://phpackages.com/packages/thecodingmachine-symfony-cache-universal-module)
```

###  Alternatives

[beryllium/cachebundle

Provides an interface to Memcache for Symfony2 applications

32136.0k](/packages/beryllium-cachebundle)

PHPackages © 2026

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