PHP code example of quantosobra / redis-service-provider

1. Go to this page and download the library: Download quantosobra/redis-service-provider library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

quantosobra / redis-service-provider example snippets


use QuantoSobra\Silex\Redis\RedisServiceProvider;

$app->register(new RedisServiceProvider(), [
    RedisServiceProvider::REDIS_OPTIONS => [
        RedisServiceProvider::OPT_HOST => 'localhost',
        RedisServiceProvider::OPT_PORT => 6379,
        RedisServiceProvider::OPT_TIMEOUT => 30,
        RedisServiceProvider::OPT_PERSISTENT => true,
        RedisServiceProvider::OPT_AUTH => 'pas$word',
        RedisServiceProvider::OPT_SERIALIZER => \Redis::SERIALIZER_NONE, // or \Redis::SERIALIZER_PHP or \Redis::SERIALIZER_IGBINARY
        RedisServiceProvider::OPT_PREFIX => 'myprefix:',
        RedisServiceProvider::OPT_DATABASE => 0
    ]
]);