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.3k↓73.3%9[1 PRs](https://github.com/lorenzo/cakephp-redis/pulls)MITPHP

Since Feb 9Pushed 2y ago2 watchersCompare

[ Source](https://github.com/lorenzo/cakephp-redis)[ Packagist](https://packagist.org/packages/lorenzo/redis)[ RSS](/packages/lorenzo-redis/feed)WikiDiscussions master Synced 2w 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

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

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

1757d 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

[cakephp/orm

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

152255.5k86](/packages/cakephp-orm)[robmorgan/phinx

Phinx makes it ridiculously easy to manage the database migrations for your PHP app.

4.5k49.7M495](/packages/robmorgan-phinx)[cakephp/database

Flexible and powerful Database abstraction library with a familiar PDO-like API

9827.0M52](/packages/cakephp-database)[cakephp/migrations

Database Migration plugin for CakePHP

13413.2M316](/packages/cakephp-migrations)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[zubzet/framework

 A lightweight PHP framework focused on rapid development, ease of use, and great portability.

1370.8k1](/packages/zubzet-framework)

PHPackages © 2026

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