1. Go to this page and download the library: Download bitandblack/typorules 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/ */
bitandblack / typorules example snippets
use BitAndBlack\TypoRules\Rule\RemoveDuplicatedWhitespaceRule;
$content = 'This is my sentence.';
$removeDuplicatedWhitespaceRule = new RemoveDuplicatedWhitespaceRule();
/**
* This will return a list of all violations, that have been found.
* You can use this for more control or an interactive process.
*/
$violations = $removeDuplicatedWhitespaceRule->getViolations($content);
/**
* This method will return the fixed content. In our example:
* `This is my sentence.`
*/
$contentFixed = $removeDuplicatedWhitespaceRule->getContentFixed($content);
use BitAndBlack\TypoRules\RuleSet\EnglishRuleSet;
$content = 'This is my - terribly - formatted sentence!!!!!';
$englishRuleSet = new EnglishRuleSet();
/**
* This will return a list of all violations, that have been found.
* You can use this for more control or an interactive process.
*/
$violations = $englishRuleSet->getViolations($content);
/**
* This method will return the fixed content. In our example:
* `This is my — terribly — formatted sentence!!`
*/
$contentFixed = $englishRuleSet->getContentFixed($content);
use BitAndBlack\TypoRules\Diff\CharacterDiff;
$content = 'Content before';
$contentFixed = 'Content, that has been fixed';
$diff = CharacterDiff::create()->getDiff($content, $contentFixed);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.