1. Go to this page and download the library: Download devtoolboxuk/cerberus 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/ */
devtoolboxuk / cerberus example snippets
use devtoolboxuk\cerberus;
$this->cerberus = new Cerberus();
$cerberus->setOptions($this->getOptions());
function testDodgyRegistration()
{
$cerberus = new CerberusService();
$cerberus->setOptions($this->getOptions());
$login_array = [
'email' => '[email protected]',
'name' => 'Visit my website http://www.doajob.org?redirect=https://www.google.com',
'address' => 'Some Street',
'postcode' => 'GL1 1AA',
'country' => 'MX',
];
$detection = $cerberus
->resetHandlers()
->pushHandler($this->createLoginStringHandler('Name', $login_array['name']))
->pushHandler($this->createLoginStringHandler('Address', $login_array['address']))
->pushHandler(new EmailHandler($login_array['email']))
->pushHandler(new CountryHandler($login_array['country']));
$detection->getScore(); //Returns a Score
$detection->getOutputByName('Name'); //Returns the cleaned sanitised output of Name;
$detection->getResult(); //Returns a result
}
private function createLoginStringHandler($name, $data)
{
$handler = new DefaultHandler($name, $data);
$handler->pushWrapper(new HtmlWrapper());
$handler->pushWrapper(new UrlWrapper());
$handler->pushWrapper(new XssWrapper());
return $handler;
}
foreach ($detection->getReferences() as $reference)
{
$reference->getInput();
}
foreach ($detection->getReferences() as $reference)
{
$reference->getOutPut();
}
$detection->getOutputByName('Name');
# eg: 'Visit my website'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.