1. Go to this page and download the library: Download medusa/validation 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/ */
medusa / validation example snippets
use Medusa\Validation\HashValidation;use Medusa\Validation\Result\ResultInterface;
$val = new HashValidation(32); // validate for hashes with a length of 32
/** @var ResultInterface $res */
$res = $val->validate('asdf');
use Medusa\Validation\Result\ResultInterface;
/** @var ResultInterface $res */
if ($res->isValid()) {
echo 'yeah - its a valid hash-32';
} else {
echo 'oh no someethin went wrong...';
echo $res->getReason();
}
use Medusa\Validation\HashValidation;
use Medusa\Validation\Result\ResultInterface;
/** @var ResultInterface $res */
if ($res->isValid()) {
echo 'fine again :)';
} else {
// 'oh no - not again';
if ($res->getReturnCode() === HashValidation::INVALID_CHARACTER_OUT_OF_BOUNDS) {
// ok give advice what went wrong
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.