crazyfactory/validation

Helper classes to validate inputs.

2.0.0 2023-03-08 06:20 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