PHPackages                             macpaw/redis-schema-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. [Caching](/categories/caching)
4. /
5. macpaw/redis-schema-bundle

ActiveSymfony-bundle[Caching](/categories/caching)

macpaw/redis-schema-bundle
==========================

A Symfony bundle to add schema prefixes for redis keys

v2.0.0(7mo ago)011.9k↓43.8%MITPHPPHP &gt;=8.3CI passing

Since Jul 28Pushed 6mo agoCompare

[ Source](https://github.com/MacPaw/redis-schema-bundle)[ Packagist](https://packagist.org/packages/macpaw/redis-schema-bundle)[ RSS](/packages/macpaw-redis-schema-bundle/feed)WikiDiscussions develop Synced 1mo ago

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

Redis Schema Bundle
===================

[](#redis-schema-bundle)

The **Redis Schema Bundle** provides automatic **Redis key namespacing** based on the current schema context, allowing **data isolation** in shared environments (e.g., staging, preview, multi-tenant).

This bundle builds on top of [Schema Context Bundle](https://github.com/macpaw/schema-context-bundle) to propagate the schema context across the app and decorate your Redis cache.

Features
--------

[](#features)

- Transparent key prefixing for Redis
- Compatible with `Symfony\Component\Cache\Adapter\RedisAdapter`
- Works with Symfony `CacheInterface` and `AdapterInterface`
- Supports schema-based multitenancy

---

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

[](#installation)

```
composer require macpaw/redis-schema-bundle
```

If you are not using Symfony Flex, register the bundle manually:

```
// config/bundles.php
return [
    Macpaw\SchemaContextBundle\SchemaContextBundle::class => ['all' => true],
    Macpaw\RedisSchemaBundle\RedisSchemaBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

Make sure to register the base Redis adapter and decorate it with the schema-aware implementation:

```
# config/services.yaml

services:
    redis_cache_adapter:
        class: Symfony\Component\Cache\Adapter\RedisAdapter
        arguments:
            - '@SymfonyBundles\RedisBundle\Redis\ClientInterface'
            - 'cache_storage'
            - '%redis_default_cache_ttl%'

    Macpaw\RedisSchemaBundle\Redis\SchemaAwareRedisAdapter:
        decorates: Symfony\Component\Cache\Adapter\RedisAdapter
        arguments:
            - '@.inner'
            - '@Macpaw\SchemaContextBundle\Service\BaggageSchemaResolver'
```

Usage
-----

[](#usage)

Anywhere you use Symfony cache services (injected via CacheInterface or AdapterInterface), your keys will automatically be prefixed based on the current schema. For example:

```
public function __construct(private CacheInterface $cache) {}

public function save(): void
{
    $this->cache->get('user.123', function () {
        return 'value';
    });
}
```

If the schema is client\_a, this will store key: client\_a.user.123.

Testing
-------

[](#testing)

To run tests:

```
vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Feel free to open issues and submit pull requests.

License
-------

[](#license)

This bundle is released under the MIT license.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance67

Regular maintenance activity

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~27 days

Total

4

Last Release

211d ago

Major Versions

v1.1.0 → v2.0.02025-10-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1935412?v=4)[MacPaw Inc.](/maintainers/macpaw)[@MacPaw](https://github.com/MacPaw)

---

Top Contributors

[![alekseytupichenkov](https://avatars.githubusercontent.com/u/8191991?v=4)](https://github.com/alekseytupichenkov "alekseytupichenkov (7 commits)")[![cod-a-holic](https://avatars.githubusercontent.com/u/15779118?v=4)](https://github.com/cod-a-holic "cod-a-holic (7 commits)")[![crossplanegithub[bot]](https://avatars.githubusercontent.com/u/1935412?v=4)](https://github.com/crossplanegithub[bot] "crossplanegithub[bot] (1 commits)")

---

Tags

backendmacpawsymfony

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/macpaw-redis-schema-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/macpaw-redis-schema-bundle/health.svg)](https://phpackages.com/packages/macpaw-redis-schema-bundle)
```

###  Alternatives

[toflar/psr6-symfony-http-cache-store

An alternative store implementation for Symfony's HttpCache reverse proxy that supports auto-pruning of expired entries and cache invalidation by tags.

574.2M13](/packages/toflar-psr6-symfony-http-cache-store)[incenteev/hashed-asset-bundle

Apply an asset version based on a hash of the asset for symfony/asset

25526.7k1](/packages/incenteev-hashed-asset-bundle)[rikudou/psr6-dynamo-db-bundle

PSR-6 and PSR-16 cache implementation using AWS DynamoDB for Symfony

2077.8k](/packages/rikudou-psr6-dynamo-db-bundle)

PHPackages © 2026

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