PHPackages                             lorenzo/redis - 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. lorenzo/redis

ActiveCakephp-plugin[Caching](/categories/caching)

lorenzo/redis
=============

CakePHP support for the Redis key-value database

2.0(4y ago)6148.0k↓50%9[1 PRs](https://github.com/lorenzo/cakephp-redis/pulls)MITPHP

Since Feb 9Pushed 1y ago2 watchersCompare

[ Source](https://github.com/lorenzo/cakephp-redis)[ Packagist](https://packagist.org/packages/lorenzo/redis)[ RSS](/packages/lorenzo-redis/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

A Redis connection adapter for CakePHP
======================================

[](#a-redis-connection-adapter-for-cakephp)

This library makes it possible to create connections for any Redis database that can be created and managed with CakePHP's `ConnectionManager`.

Redis is a great Key-Value database with excelent performance. It also offers several unique features for working with large lists, hashmaps and even pub-sub systems.

Connecting to the redis database
--------------------------------

[](#connecting-to-the-redis-database)

This library assumes that you either have installed `phpredis` or `predis`. We recommend installing `phpredis`

- [PhpRedis](https://github.com/phpredis/phpredis) (recommended)
- [Predis](https://github.com/nrk/predis)

### Configuring it in in your app.php file in

[](#configuring-it-in-in-your-appphp-file-in)

Just add any new named configuration under the `Datasources` key

```
    'Datasources' => [
        ...
        'redis' => [
            'className' => 'Cake\Redis\RedisConnection',
            'driver' => 'phpredis', // Can also use a full class name or 'predis'
            'log' => false, // Log executed commands
            'host' => '127.0.0.1',
            'port' => 6379,
            'timeout' => [optional],
            'reconnectionDelay' => [optional],
            'persistentId' => [optional],
            'database' => [optional],
            'options' => [], // extra options for the driver
        ]
    ]
```

### Using ConnectionManager

[](#using-connectionmanager)

You can also create new redis connections with the `ConnectionManger`

```
use Cake\Datasource\ConnectionManager;

ConnectionManager::config('redis', [
    'className' => 'Cake\Redis\RedisConnection',
    'driver' => 'Cake\Redis\Driver\PHPRedisDriver',
    'log' => false, // Log executed commands
    'host' => '127.0.0.1',
    'port' => 6379,
    'timeout' => [optional],
    'reconnectionDelay' => [optional],
    'persistentId' => [optional],
    'database' => [optional],
    'options' => [], // extra options for the driver
]);
```

Executing commands in Redis
---------------------------

[](#executing-commands-in-redis)

You need to get a hold of the connection and the execute commands:

```
$redis = ConnectionManager::get('redis');
$redis->set('cakephp', 'awesome');
echo $redis->get('cakephp'); // Returns 'awesome'
```

Make sure you take a look at all the commands you can run in the [PHPRedis Readme](https://github.com/phpredis/phpredis/blob/develop/README.markdown).

Executing a list of commands in a transaction
---------------------------------------------

[](#executing-a-list-of-commands-in-a-transaction)

```
$redis = ConnectionManager::get('redis');
$redis->transactional(function ($client) {
    $client
        ->set('cakephp', 'awesome')
        ->set('another_key', 'value')
});
```

The client instance the closure gets will buffer all the commands and execute them atomically at the end of the chain.

This method uses the `multi()` command internally.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~1718 days

Total

2

Last Release

1667d ago

Major Versions

1.0 → 2.02021-10-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b4694a64f9dab01ec0e776946b15c84113dee8a51344f1c394f40bd7a453312?d=identicon)[lorenzo](/maintainers/lorenzo)

---

Top Contributors

[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (9 commits)")[![Juanchimienti](https://avatars.githubusercontent.com/u/12194399?v=4)](https://github.com/Juanchimienti "Juanchimienti (4 commits)")[![giboow](https://avatars.githubusercontent.com/u/1560862?v=4)](https://github.com/giboow "giboow (1 commits)")[![johanmeiring](https://avatars.githubusercontent.com/u/1214876?v=4)](https://github.com/johanmeiring "johanmeiring (1 commits)")

---

Tags

cakephppluginredis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lorenzo-redis/health.svg)

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

###  Alternatives

[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)[cakephp/orm

CakePHP ORM - Provides a flexible and powerful ORM implementing a data-mapper pattern.

151242.6k70](/packages/cakephp-orm)[cheprasov/php-redis-client

Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0

1281.2M21](/packages/cheprasov-php-redis-client)

PHPackages © 2026

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