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

ActiveLibrary[Caching](/categories/caching)

switon/redis
============

Pooled Redis client with transient connections for transactions, scans, and blocking commands for Switon Framework

v1.0.0(1mo ago)03310MITPHPPHP &gt;=8.3CI passing

Since Jun 7Pushed 2mo agoCompare

[ Source](https://github.com/switon-php/redis)[ Packagist](https://packagist.org/packages/switon/redis)[ Docs](https://github.com/switon-php/redis)[ RSS](/packages/switon-redis/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (10)Versions (2)Used By (10)

Switon Redis Package
====================

[](#switon-redis-package)

[![CI](https://camo.githubusercontent.com/6ad7ca19354217e9693bf012ff575fd8aa1f6b11f30df536a1cef25e3ce9273d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769746f6e2d7068702f72656469732f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/switon-php/redis/actions/workflows/ci.yml) [![PHP 8.3+](https://camo.githubusercontent.com/c03f51341eebaefabbf137e291b20523fc74b4ffd084406d88524d266d95085d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d373737424234)](https://www.php.net/)

Switon's Redis client package with a native Redis-style API, pooled-mode safety, URI-based connectors, and connect/call lifecycle events.

Highlights
----------

[](#highlights)

- **Redis-style command calls:** the client keeps Redis's native method style, so Redis users can pick it up quickly.
- **Separate connection modes:** pooled and transient clients stay separate.
- **URI-based routing:** `Connection` supports `redis://`, `rediss://`, `sentinel://`, and `cluster://` targets.
- **Connection visibility:** connect, call, and close activity can be observed.
- **Pool-safe calls:** pooled clients keep a `getTransient()` escape hatch for stateful commands.

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

[](#installation)

```
composer require switon/redis
```

Quick Start
-----------

[](#quick-start)

```
use Switon\Core\Attribute\Autowired;
use Switon\Redis\ClientInterface;

class UserCache
{
    #[Autowired] protected ClientInterface $redis;

    public function save(int $userId, array $data): void
    {
        $this->redis->set("user:{$userId}", json_encode($data), 3600);
    }

    public function replaceSession(string $sessionId, array $data): void
    {
        $redis = $this->redis->getTransient();
        $redis->watch("session:{$sessionId}");
        $redis->multi();
        $redis->set("session:{$sessionId}", json_encode($data));
        $redis->set("session:{$sessionId}:updated_at", (string)time());
        $redis->exec();
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance87

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

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

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (6 commits)")

---

Tags

cachepoolingredisswitonrediscachepoolingswiton

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[tedivm/stash

The place to keep your cache.

9634.9M130](/packages/tedivm-stash)[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

973172.3k2](/packages/awssat-laravel-visits)[cache/redis-adapter

A PSR-6 cache implementation using Redis (PhpRedis). This implementation supports tags

584.1M27](/packages/cache-redis-adapter)[tedivm/stash-bundle

Incorporates the Stash caching library into Symfony.

871.4M16](/packages/tedivm-stash-bundle)[kdyby/redis

Redis storage for Nette Framework

491.7M2](/packages/kdyby-redis)[matomo/cache

PHP caching library based on Doctrine cache

381.3M26](/packages/matomo-cache)

PHPackages © 2026

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