1. Go to this page and download the library: Download scherhak/is-gibberish 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/ */
scherhak / is-gibberish example snippets
use IsGibberish\Detector;
$detector = new Detector();
$input = "asdf 24qf waefasdf arg aerg ergeara asd";
if ($detector->isGibberish($input)) {
// Handle as invalid input
echo "Please enter a real message.";
}
if ($detector->isGibberish($input, [
'threshold' => 35.0,
])) {
echo "Please enter a real message.";
}
if ($detector->isGibberish($input, [
'weights' => [
'token_pattern' => 30.0,
'keyboard_pattern' => 70.0,
],
])) {
echo "Please enter a real message.";
}