PHPackages                             predis/service-provider - 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. predis/service-provider

ActiveLibrary[Caching](/categories/caching)

predis/service-provider
=======================

Predis service provider for the Silex microframework

v2.0.0(9y ago)68546.6k↓35.5%201MITPHPPHP &gt;=5.3.2

Since Oct 2Pushed 8y ago4 watchersCompare

[ Source](https://github.com/nrk/PredisServiceProvider)[ Packagist](https://packagist.org/packages/predis/service-provider)[ Docs](https://github.com/nrk/PredisServiceProvider)[ RSS](/packages/predis-service-provider/feed)WikiDiscussions v2.0 Synced 1mo ago

READMEChangelogDependencies (3)Versions (13)Used By (1)

Predis ServiceProvider
======================

[](#predis-serviceprovider)

[![Latest Stable Version](https://camo.githubusercontent.com/7763b8e92f788fc430538baae5829b290e258a65db9d40d6271df580c8a20932/68747470733a2f2f706f7365722e707567782e6f72672f7072656469732f736572766963652d70726f76696465722f762f737461626c652e706e67)](https://packagist.org/packages/predis/service-provider)[![Total Downloads](https://camo.githubusercontent.com/ea557e7c87b9429840d32fe69a1ba50bc3e1c20214fd1017dec43e7538812da5/68747470733a2f2f706f7365722e707567782e6f72672f7072656469732f736572766963652d70726f76696465722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/predis/service-provider)[![License](https://camo.githubusercontent.com/4736f7eb7ab6bae34357527bc694be03ef804be290c62f033de420bddc10b956/68747470733a2f2f706f7365722e707567782e6f72672f7072656469732f736572766963652d70726f76696465722f6c6963656e73652e737667)](https://packagist.org/packages/predis/service-provider)[![Build Status](https://camo.githubusercontent.com/f2ca2dc6f485441a5993c8a0105dec0cbc4d21b7247f9ac63fd001915ea19b98/68747470733a2f2f7472617669732d63692e6f72672f6e726b2f5072656469735365727669636550726f76696465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nrk/PredisServiceProvider)[![HHVM Status](https://camo.githubusercontent.com/73879221b43a800aa8979e13302eb6118a88b273ebd4ece6bde78b159f7ad8f1/687474703a2f2f6868766d2e683463632e64652f62616467652f7072656469732f736572766963652d70726f76696465722e706e67)](http://hhvm.h4cc.de/package/predis/service-provider)

This service provider for [Silex](http://silex-project.org/) allows developers to easily configure and expose [Predis](http://github.com/nrk/predis) enabling them to use [Redis](http://redis.io) in their applications.

### Getting started

[](#getting-started)

Supposing that the skeleton of your application is ready, you simply need to register this service provider by specifying the parameters and options needed to access Redis:

```
$app->register(new Predis\Silex\ClientServiceProvider(), [
    'predis.parameters' => 'tcp://127.0.0.1:6379',
    'predis.options'    => [
        'prefix'  => 'silex:',
        'profile' => '3.0',
    ],
]);
```

This will register one instance of `Predis\Client` accessible from anywhere in your application by using `$app['predis']`. Both `predis.parameters` and `predis.options` are optional and they accept the same values accepted by the constructor of `Predis\Client` (see the documentation of Predis).

Certain applications might need more than one client to reach different servers or configured with different options. In such cases you must use `Predis\Silex\ClientsServiceProvider` providing a list of clients with their own parameters and options using `predis.clients`:

```
$app->register(new Predis\Silex\ClientsServiceProvider(), [
    'predis.clients' => [
        'client1' => 'tcp://127.0.0.1:6379',
        'client2' => [
            'host' => '127.0.0.1',
            'port' => 6380,
        ],
        'client3' => [
            'parameters' => 'tcp://127.0.0.1:6381',
            'options' => [
                'profile' => 'dev',
                'prefix'  => 'silex:',
            ],
        ],
    ),
]);
```

Clients will be exposed to your application using `$app['predis'][$alias]` where `$alias` is the key used to populate the items of `predis.clients`. Optionally, it is possible to set a default client by specifying its alias in `predis.default_client` making it accessible simply by invoking methods of `Predis\Client` directly against `$app['predis']`. Client instances are lazily initialized upon the first access.

**NOTE**: this is not the same as using a cluster of nodes or replication as it will only create and set up independent client instances. Cluster and replication thus work with both single and multiple client configurations, you just need to provide the needed parameters and options for each instance of `Predis\Client`.

You can find more details on how to use this provider in the `examples` directory or the test suite.

### Reporting bugs and contributing code

[](#reporting-bugs-and-contributing-code)

Contributions are highly appreciated either in the form of pull requests for new features, bug fixes or just bug reports. We only ask you to adhere to a [basic set of rules](CONTRIBUTING.md) before submitting your changes or filing bugs on the issue tracker to make it easier for everyone to stay consistent while working on the project.

### Project links

[](#project-links)

- [Source code](http://github.com/nrk/PredisServiceProvider)
- [Issue tracker](http://github.com/nrk/PredisServiceProvider/issues)

### Author

[](#author)

- [Daniele Alessandri](mailto:suppakilla@gmail.com)([github](http://github.com/nrk)) ([twitter](http://twitter.com/JoL1hAHN))

### Contributors

[](#contributors)

- Jérôme Macias ([github](http://github.com/jeromemacias))

### License

[](#license)

The code for Predis ServiceProvider is distributed under the terms of the [MIT license](LICENSE).

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 93.7% 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

Every ~171 days

Recently: every ~284 days

Total

12

Last Release

3459d ago

Major Versions

v0.4.2 → v1.0.02014-08-06

v1.0.x-dev → v2.0.02016-11-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/402afa761e9c577e89fe869f50dbeb2f6bae2c52051675dd7922672747bfa6ab?d=identicon)[nrk](/maintainers/nrk)

---

Top Contributors

[![nrk](https://avatars.githubusercontent.com/u/17923?v=4)](https://github.com/nrk "nrk (89 commits)")[![igorw](https://avatars.githubusercontent.com/u/88061?v=4)](https://github.com/igorw "igorw (1 commits)")[![jeromemacias](https://avatars.githubusercontent.com/u/582446?v=4)](https://github.com/jeromemacias "jeromemacias (1 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (1 commits)")[![ragboyjr](https://avatars.githubusercontent.com/u/1975857?v=4)](https://github.com/ragboyjr "ragboyjr (1 commits)")[![SpacePossum](https://avatars.githubusercontent.com/u/10462973?v=4)](https://github.com/SpacePossum "SpacePossum (1 commits)")[![naderman](https://avatars.githubusercontent.com/u/154844?v=4)](https://github.com/naderman "naderman (1 commits)")

---

Tags

redispredissilex

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/predis-service-provider/health.svg)

```
[![Health](https://phpackages.com/badges/predis-service-provider/health.svg)](https://phpackages.com/packages/predis-service-provider)
```

###  Alternatives

[predis/predis-async

Asynchronous version of Predis

366348.4k](/packages/predis-predis-async)[jamescauwelier/psredis

Sentinel client for the popular php redis client

77392.9k5](/packages/jamescauwelier-psredis)[cache/predis-adapter

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

272.6M13](/packages/cache-predis-adapter)[contributte/redis

Redis client integration into Nette framework

181.6M2](/packages/contributte-redis)[maykonn/codeigniter-predis

The CodeIgniter Redis package

129.3k](/packages/maykonn-codeigniter-predis)[quick/cache

This is a cache system that uses Redis for rapid caching.

122.7k](/packages/quick-cache)

PHPackages © 2026

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