Define a validation class and an accompanying exception class in the proper namespace, and the Validation library will automagically use them to validate your data, as such:
myCustomValidator.php:
<?php
namespace Respect\Validation\Rules;
class myCustomValidator extends AbstractRule
{
public function validate($input)
{
return true; // Implement actual check here; eg: return is_string($input);
}
}
myCustomValidatorException.php:
<?php
namespace Respect\Validation\Exceptions;
class myCustomValidatorException extends ValidationException
{
public static $defaultTemplates = array(
self::MODE_DEFAULT => array(
self::STANDARD => '{{name}} must ... ', // eg: must be string
),
self::MODE_NEGATIVE => array(
self::STANDARD => '{{name}} must not ... ', // eg: must not be string
)
);
}
As long as these files are included in your project, Validator::myCustomValidator()->assert( $input );
should now work.
This obviously relies on naming conventions, so be sure to use the class name to call the self-defined validator and you should be set.