PHP code example of stantabcorp / validator
1. Go to this page and download the library: Download stantabcorp/validator 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/ */
stantabcorp / validator example snippets
$validator = new \Stantabcorp\Validator\Validator(["array" => ["to" => "validate"]]); // Init the library providing an array to validate.
$validator->ator->getErrors(); // Return a list of string containing the error messages.
$validator->customValidation("array", function (\Stantabcorp\Validator\CustomValidator $customValidator) {
$customValidator->getKey(); // The key (`array` in this case)
$customValidator->getValue(); // The associated value
// Mark the kay as invalid and add an error message.
$customValidator->addError("This is an error message");
});