mheap/silex-predis

This package is abandoned and no longer maintained. No replacement package was suggested.

Predis extension for Silex

2.0.0 2017-10-11 14:42 UTC

This package is auto-updated.

Last update: 2020-11-26 18:46:37 UTC


README

Build Status

Requirements

This extension only works with PHP 7.0+ and Silex 2. Version 1.0.0 is compatible with Silex 1.

Installation

Install with composer:

composer require mheap/silex-predis

Usage

Before you can use this extension you need to register it with your application. You specify a server to connect to at this point, as well as any other configuration options

$app->register(new SilexPredis\PredisExtension(), array(
    'predis.server'  => array(
        'host' => '127.0.0.1',
        'port' => 6379
    ),
    'predis.config'  => array(
        'prefix' => 'predis__'
    )
));

Once the extension is registered, it'll be available as $app['predis']:

$app->get('/', function() use($app) {
    $app['predis']->set('my_value', 'This is an example');
    $value = $app['predis']->get('my_value');
});

Running the tests

You'll need Redis running on port 6379 locally to run the tests. If you don't have Redis installed you can run docker-compose up to run it in a container instead.