1. Go to this page and download the library: Download muradyanvano/php-lexorank 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/ */
muradyanvano / php-lexorank example snippets
use MuradyanVano\LexoRank\LexoRank;
use MuradyanVano\LexoRank\LexoRankService;
$first = LexoRank::middle(); // 0|hzzzzz:
$second = $first->after(); // strictly after first
$between = $first->between($second); // strictly between
$service = new LexoRankService();
$bulk = $service->initialRanks(10); // 10 evenly spaced ranks in bucket 0
use MuradyanVano\LexoRank\LexoRankBucket;
LexoRank::middle()->inNextBucket()->toString(); // 1|hzzzzz:
LexoRankBucket::bucket0()->next(); // bucket1
use MuradyanVano\LexoRank\LexoRankCollection;
$collection = LexoRankCollection::from(['0|100000:', '0|300000:']);
$sorted = $collection->sorted();
$collection->assertStrictlyOrdered();
$collection->duplicates();
$collection->suggestsRebalance(); // default soft length 64
$collection->rankForInsertAt(1); // rank between index 0 and 1
use MuradyanVano\LexoRank\Rebalancer;
$rebalancer = new Rebalancer();
$result = $rebalancer->rebalance($orderedRankStrings);
$result->bucket();
$result->mapping(); // old => new
$result->map('0|very-long-rank:');
$rebalancer->shouldRebalance($ranks, softLength: 64);