crazyfactory/validation

Helper classes to validate inputs.

1.0.4 2021-12-07 10:19 UTC

README

This repo contains Helper classes used for various Validation tasks

Example usage

use CrazyFactory\Validation\ZipCode\Validator as ZipCodeValidator;
use CrazyFactory\Validation\ZipCode\Sanitizer as ZipCodeSanitizer;

$isValidZipCode = ZipCodeValidator::isValid($zipCode, $countryCode);
// => bool

$zipCode = ZipCodeSanitizer::sanitize($zipCode, $countryCode);
// => a sanitized and valid zip code (original code on failure)

Requirements

  • php: >7.1
  • composer installed

Scripts

Run Tests

composer test

Lint

composer lint

Auto-fix of linting errors

composer lint:fix