Predis

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

Library
Composer
vv3.6.1
7,779 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 88
Maintenance 80
Community 88
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 85
Code Quality 88
Innovation 72
Learning Curve 78

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
73%
MIT

Bagisto

Analytics · Ecommerce

28,186

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
67
Dependency
Built with
PHP 73%
Blade 21%
Updated 1 weeks ago
PHP
48%
AGPL 3.0

Crater

Invoicing Finance

8,349

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
68
Dependency
Built with
PHP 48%
Vue 40%
Updated 2 years ago
JavaScript
69%
AGPL 3.0

Fleetbase

Logistics

3,940

Modular open-source logistics and supply chain operating system

View details
93
Repo Health
75
Technical
68
Dependency
Built with
JavaScript 69%
PHP 11%
Updated 4 days ago
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,123

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
PHP 85%
Updated 1 weeks ago
PHP
82%
Other

Mautic

Automation · Ecommerce · Marketing

10,570

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

View details
97
Repo Health
76
Technical
63
Dependency
Built with
PHP 82%
Updated 1 weeks ago
PHP
69%
AGPL 3.0

Pixelfed

Social Media

7,105

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

View details
91
Repo Health
68
Technical
65
Dependency
Built with
PHP 69%
Vue 22%
Updated 5 days ago
PHP
84%
MIT

wallabag

Bookmarks Archiving

12,989

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
93
Repo Health
81
Technical
59
Dependency
Built with
PHP 84%
Twig 13%
Updated 4 days ago

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