Skip to content
nrk edited this page Jan 12, 2012 · 21 revisions

About Predis

Predis is a flexible and feature-complete PHP client library for the Redis key-value store.

We are currently in the process of rewriting the whole wiki with new contents, documentation and tips!

Predis requires PHP >= 5.3 and it is entirely written in PHP so it can be used without the need to build and install a native extension for the interpreter, making it also easier and faster to add new features which is great given how fast the development of Redis proceeds.

The latest stable release is v0.7.1 and it can be downloaded from GitHub as a ZIP or TGZ.

It is also available on Packagist for an easy installation using Composer. Composer helps you manage dependencies for your projects and libraries without much hassle which makes it the preferred way to get up and running with new applications. Alternatively, the library is available on our own PEAR channel for a more traditional installation via PEAR. Zip and tar.gz archives are also downloadable from GitHub by browsing the list of tagged releases.

Main features

  • Complete support for Redis from 1.2 to 2.4 and the current development versions using different server profiles.
  • Client-side sharding with support for consistent hashing or custom distribution strategies.
  • Support for master / slave replication configurations (write on master, read from slaves).
  • Command pipelining on single and aggregated connections.
  • Transparent key prefixing strategy capable of handling any command known that has keys in its arguments.
  • Abstraction for Redis transactions (Redis >= 2.0) with support for CAS operations (Redis >= 2.2).
  • Connections to Redis instances are automatically and lazily estabilished upon the first call to a command.
  • Ability to connect to Redis using TCP/IP or UNIX domain sockets with support for persistent connections.
  • Ability to use alternative connection classes to use different types of network or protocol backends.
  • Flexible system to define and register your own set of commands or server profiles to client instances.

Quick tour

This quick tour gives you a quick introduction on how Predis can be configured and used. [OUTDATED: that page actually refers to Predis v0.6, we are still rewriting the whole wiki!]

Frameworks integration

Predis can be used as-is with any PHP web framework out there but sometimes it is easier to use ad-hoc extensions that make it blend nicely into their logic and common patterns. What follows is a list of such extensions created and maintained by the community:

The following modules require the PHP 5.2 backport of Predis 5.2:

Contributing

If you want to work on Predis, it is highly recommended that you first run the test suite in order to check that everything is OK, and report strange behaviours or bugs. When modifying Predis please make sure that no warnings or notices are emitted by PHP by running the interpreter in your development environment with the error_reporting variable set to E_ALL | E_STRICT.

The recommended way to contribute to Predis is to fork the project on GitHub, create new topic branches on your newly created repository to fix or add features (possibly with tests covering your modifications) and then open a new pull request with a description of the applied changes. Obviously you can use any other Git hosting provider of your preference.

License

The code for Predis is distributed under the terms of the MIT license.

Clone this wiki locally