Download the PHP package phpdot/redis without Composer
On this page you can find all versions of the php package phpdot/redis. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package redis
Short Description Coroutine-safe Redis client wrapping ext-redis with auto-reconnect, exponential backoff, exception translation, and a pool connector for phpdot/pool.
License MIT
Informations about the package redis
phpdot/redis
A coroutine-safe Redis client wrapping ext-redis (phpredis). It
adds automatic reconnection with exponential backoff, translates driver errors into typed exceptions,
and ships a connector so phpdot/pool can hold and recycle connections.
One \Redis client lives per connection, so a pool gives each Swoole coroutine its own.
Table of Contents
- Requirements
- Installation
- Usage
- Architecture
- Testing
- License
Requirements
| Requirement | Constraint |
|---|---|
| PHP | >= 8.5 |
ext-redis |
^6.0 |
phpdot/contracts |
^0.5 |
phpdot/container is a dev-only suggestion — the #[Config('redis')] attribute on RedisConfig is
inert until a phpdot application reflects it.
Installation
Usage
Connecting
RedisConfig is an immutable value object carrying every ext-redis connection option — host/port or a
Unix socket path, username/password (ACL or legacy AUTH), database, TLS with stream SSL options,
timeouts, and maxRetries for the backoff.
Resilience
connect() retries with exponential backoff (100ms, 200ms, 400ms, …) up to maxRetries before throwing
a ConnectionException. Authentication failures throw an AuthenticationException immediately — retrying
bad credentials never helps. Both extend the package's RedisException base.
Pooling
RedisConnector adapts a RedisConnection to phpdot/pool's ConnectorInterface, so a pool can build,
health-check, and recycle connections:
Architecture
RedisConnection owns one ext-redis \Redis client and drives its lifecycle — connecting with backoff,
pinging for liveness, and translating RedisExceptions into the package's typed hierarchy.
RedisConnector is the thin bridge to phpdot/pool, so the connection type stays pool-agnostic.
Testing
The unit suite covers the disconnected-state contract with no server. The integration suite connects to
a live Redis at 127.0.0.1:6379 and skips automatically when none is reachable.
License
MIT.
This repository is a read-only mirror, generated by CI from phpdot/monorepo. Pull requests and issues belong in the monorepo.