PHP code example of angyvolin / predis-commands

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

    

angyvolin / predis-commands example snippets




ngyvolin\Predis\Command;

$client = new Predis\Client();
$client->getProfile()->defineCommand('zpop', Command\ZSetPop::class);
$client->getProfile()->defineCommand('zrpop', Command\ZSetReversePop::class);



use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Angyvolin\Predis\Command;

class PredisCommandsServiceProvider implements ServiceProviderInterface
{
    public function register(Container $app)
    {
        $app->extend('redis', function ($redis) {
            /* @var \Predis\Client $redis */
            $redis->getProfile()->defineCommand('zpop', Command\ZSetPop::class);
            $redis->getProfile()->defineCommand('zrpop', Command\ZSetReversePop::class);
        
            return $redis;
        });
    }
}