1. Go to this page and download the library: Download digitalrevolution/jbdiff 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/ */
digitalrevolution / jbdiff example snippets
switch ($strategy) {
case RateLimiterConfig::FIXED_WINDOW:
return new FixedWindow($this->redisService->getConnection(), $config);
case RateLimiterConfig::SLIDING_WINDOW:
return new SlidingWindow($this->redisService->getConnection(), $config);
default:
throw new RuntimeException('Invalid Strategy name.', RuntimeException::UNKNOWN);
}
return match ($strategy) {
RateLimiterConfig::FIXED_WINDOW => new FixedWindow($this->redisService->getConnection(), $config),
RateLimiterConfig::SLIDING_WINDOW => new SlidingWindow($this->redisService->getConnection(), $config),
default => throw new RuntimeException('Invalid Strategy name.'),
};
use DR\JBDiff\ComparisonPolicy;
use DR\JBDiff\JBDiff;
// line block will contain all the information to partition the strings in removed, unchanged and added parts.
$lineBlocks = (new JBDiff())->compare($textBefore, $textAfter, ComparisonPolicy::DEFAULT);
// to iterate over the string parts
$iterator = new LineBlockTextIterator($textBefore, $textAfter, $lineBlocks);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.