1. Go to this page and download the library: Download initphp/redis 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/ */
initphp / redis example snippets
use \InitPHP\Redis\Redis;
// Provide your connection information;
$redis = new Redis([
'prefix' => 'i_',
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
]);
// Use Setter and Getter;
$redis->set('name', 'muhammet');
if($redis->has('name')){
echo $redis->get('name'); // "muhammet"
}
/**
* or tell the get method what it will
* do if it can't find it,
* or a default value it will return;
*/
echo $redis->get('username', 'Undefined'); // "Undefined"
echo $redis->get('surname', function () use ($redis) {
$value = 'ŞAFAK';
$redis->set('surname', $value);
return $value;
}); // "ŞAFAK"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.