PHP code example of anper / predis-command-collector
1. Go to this page and download the library: Download anper/predis-command-collector 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/ */
anper / predis-command-collector example snippets
php
use Anper\Predis\CommandCollector\Collector;
use function Anper\Predis\CommandCollector\register_collector;
$client = new \Predis\Client(...);
register_collector($client, $collector = new Collector($client));
// redis queries...
foreach($collector->getProfiles() as $profile) {
echo $profile->getCommandAsString();
}
php
use Anper\Predis\CommandCollector\Profile;
use function Anper\Predis\CommandCollector\register_collector;
$collector = function (Profile $profile) {
echo $profile->getCommandAsString();
};
register_collector($client, $collector);