1. Go to this page and download the library: Download jsidorenko/redcard 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/ */
jsidorenko / redcard example snippets
$redis = new Predis\Client(array(
'scheme' => 'tcp',
'host' => 'localhost',
'port' => 6379,
));
$autocomplete = new JSidorenko\RedCard\RedisAutocomplete( $redis );
or
$autocomplete = new JSidorenko\RedCard\RedisAutocomplete( $redis, "yourDomainPrefix" );
instead of "yourDomainPrefix" you can write something like "users" or "locations"
$autocomplete->store(2, "Mary", "users");
$autocomplete->store(3, "Sally", "users");
$autocomplete->store(4, "Leo", "users" );
$autocomplete->store(5, "Mary Had A Litte Lamb", "blog-title");
$autocomplete->store(6, "Redis Rocks, A Life Story", "blog-title");
$results = $autocomplete->find("Mary", "users");
// Will only return Mary instead of "Mary Had A Litte Lamb"