Predis

A flexible, pure-PHP Redis and Valkey client with clustering and replication support

Library
Composer
vv3.6.0
7,780stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
91/100Excellent
Development Activity92
Maintenance84
Community88
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture85
Code Quality88
Innovation72
Learning Curve78

Predis is a feature-complete Redis (and Valkey) client for PHP that requires no C extension — it implements the full RESP protocol in pure PHP, so it can be installed with just Composer on any host, including shared or restricted environments where compiling phpredis isn’t an option. It supports every Redis command surface from version 3.0 through 8.0, plus abstractions for transactions (MULTI/EXEC), Lua scripting with automatic EVALSHA/EVAL fallback, pipelining, and cursor-based iterators for SCAN/SSCAN/ZSCAN/HSCAN.

Beyond single-node connections, Predis has built-in support for client-side sharded clusters, Redis Cluster, master-replica replication topologies, and Redis Sentinel for automatic failover discovery. Connections are established lazily and can be TCP, TLS-encrypted, UNIX sockets, or persistent, and the library exposes a pluggable connection-factory and command-factory system so custom protocol or command behavior can be layered in without forking the library.

What You Get

  • A Predis\Client class supporting Redis 3.0 through 8.0 commands via named-array or URI-string connection parameters
  • Aggregate connections for client-side sharded clusters, Redis Cluster, master-replica replication, and Sentinel-based failover
  • Abstractions for MULTI/EXEC transactions, CAS operations, and Lua scripting with automatic EVALSHA/EVAL switching
  • Command pipelining and PHP-iterator-based cursors for SCAN/SSCAN/ZSCAN/HSCAN
  • TCP, TLS/SSL, UNIX-socket, and persistent connection support, plus transparent key-prefixing

Common Use Cases

  • Adding Redis-backed caching, sessions, or queues to a PHP application on hosts where the phpredis C extension can’t be installed
  • Connecting to a Redis Cluster or Sentinel-managed replica set from PHP with automatic node/failover discovery
  • Running Lua scripts against Redis for atomic multi-key operations without needing raw EVAL/EVALSHA bookkeeping
  • Building multi-tenant PHP applications that need transparent key-prefixing to isolate tenants sharing one Redis instance

Under The Hood

Architecture - src/Client.php is the central entry point, delegating command execution to a connection resolved via src/Connection/ (single-node, cluster, or replication aggregates under src/Cluster/ and src/Replication/); src/Command/ implements each Redis command as its own class through a command factory, src/Protocol/ implements the RESP wire protocol parser/serializer, and src/Transaction/, src/Pipeline/, and src/Monitor/ layer transaction, pipelining, and MONITOR support on top of the same connection abstraction. src/Configuration/ implements the options container that wires together connection factories, cluster/replication backends, and command factories at client construction time. Tech Stack - Pure PHP 7.2/8.x with no required C extension; the only hard dependency is psr/http-message, with an optional suggestion for the relay PECL extension for faster in-memory caching. Dev tooling includes PHPStan for static analysis and PHP-CS-Fixer for style enforcement. Code Quality - The tests/ directory contains 561 PHP test files (PHPUnit) covering individual command classes, each connection backend, cluster/replication aggregation logic, and protocol edge cases — one of the most thoroughly tested PHP Redis clients available. The project has 2,734 total commits across 63 tagged releases and averages 10+ commits/month, reflecting sustained active maintenance under lead maintainer Till Krüss. API Design - The client API mirrors Redis command names directly ($client->set(), $client->get(), $client->zadd()), so developers familiar with redis-cli find the PHP surface immediately recognizable; connection and cluster/replication configuration is handled via a single options array passed to the constructor, keeping the common case (a single new Predis\Client() call) simple while still exposing advanced configuration for clustering and custom backends.

Used by 7 apps in this directory

PHP
72%
MIT

Bagisto

Analytics · Ecommerce

27,983

Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.

View details
93
Repo Health
75
Technical
69
Dependency
Built with
PHP72%
Blade22%
Updated today
PHP
48%
AGPL 3.0

Crater

Invoicing Finance

8,341

Open source invoicing and billing platform for freelancers and small businesses — create estimates, track expenses, accept Stripe payments, and run recurring invoices from your own server.

View details
54
Repo Health
68
Technical
69
Dependency
Built with
PHP48%
Vue40%
Updated 2 years ago
JavaScript
70%
AGPL 3.0

Fleetbase

Logistics

2,510

Modular open-source logistics and supply chain operating system

View details
91
Repo Health
75
Technical
68
Dependency
Built with
JavaScript70%
PHP10%
Updated today
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,008

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
97
Repo Health
83
Technical
62
Dependency
Built with
PHP85%
XSLT10%
Updated 2 days ago
PHP
82%
Other

Mautic

Automation · Marketing · Ecommerce

10,366

The world's largest open source marketing automation platform — own your data, run multi-channel campaigns, and escape vendor lock-in forever.

View details
98
Repo Health
76
Technical
64
Dependency
Built with
PHP82%
Updated yesterday
PHP
55%
AGPL 3.0

Pixelfed

Social Media

7,069

A decentralized, self-hosted photo sharing platform built on ActivityPub for the open Fediverse.

View details
86
Repo Health
68
Technical
69
Dependency
Built with
PHP55%
Vue32%
Blade13%
Updated yesterday
PHP
84%
MIT

wallabag

Bookmarks Archiving

12,917

Self-hosted read-it-later app that saves clean, ad-free articles from any webpage for distraction-free reading across all your devices.

View details
92
Repo Health
81
Technical
59
Dependency
Built with
PHP84%
Twig13%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search