1. Go to this page and download the library: Download terminusstudio/phpvalidator 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/ */
terminusstudio / phpvalidator example snippets
php
$config = [
'useSession' => false
];
php
Container::set('validator', function() {
return new \TS\PHPValidator\Validator($config);
});
php
$validator = new \TS\PHPValidator\Validator($config);
php
Container::set('view', function() {
$view = Twig::create(....);
// Add the validator extension and pass the validator instance to it
$view->addExtension(
new \TS\PHPValidator\ValidatorTwig(Container::get('validator'))
);
return $view;
});