PHP code example of nanoblocktech / php-similarity-check

1. Go to this page and download the library: Download nanoblocktech/php-similarity-check 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/ */

    

nanoblocktech / php-similarity-check example snippets


use Luminova\ExtraUtils\SimilarityChecker\Check;


$check = new Check();
try {
    $score = $check->name('Peter Foo', 'Paul Foo'); 

    echo "Percentage: {$score->getRate()}%\n";
    echo "Ratio: {$distance->getRatio()}\n";
} catch (InvalidArgumentException $e){
    echo $e->getMessage();
}

$score = Check::compare('Foo', 'Faa'); 

echo "Percentage: {$score->getRate()}%\n";
echo "Ratio: {$distance->getRatio()}\n";

if($score->getRate() >= 50){
 echo "Allow execution";
}else{
  echo "Sorry your name does not match with your account profile name";
}
bash
composer