PHP code example of predis / service-provider

1. Go to this page and download the library: Download predis/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/ */

    

predis / service-provider example snippets


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

$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:',
            ],
        ],
    ),
]);