Validators
class Validators (View source)
Utility class providing static validation methods for various data formats.
This helper centralizes all validation logic used throughout the system, ensuring consistency and reusability for user input, identifiers, and business rules.
Methods
Validates a Brazilian CPF number.
Validates the structure of a course name.
Validates a password structure according to system security rules.
Validates a full name according to format and length rules.
Validates a Brazilian mobile phone number.
Validates the structure of an email address and checks MX DNS records.
Validates an ISBN-10 or ISBN-13 format and checksum.
Validates a loan code in the format LNXXXXXXXX.
Details
static bool
validateCpf(string $cpf)
Validates a Brazilian CPF number.
static bool
validateCourseName(string $course)
Validates the structure of a course name.
static bool
validatePasswordStructure(string $password)
Validates a password structure according to system security rules.
Password must:
- Be 8–16 characters long.
- Include at least one uppercase and one lowercase letter.
- Include at least one digit and one special character.
static bool
validateFullName(string $name)
Validates a full name according to format and length rules.
Name must contain:
- Only letters, spaces, hyphens or apostrophes.
- At least two words.
- Between 3 and 100 characters.
static bool
validatePhoneNumber(string $number)
Validates a Brazilian mobile phone number.
Rules:
- 11 digits (including DDD)
- Valid DDD
- Must start with 9 after the DDD
static bool
validateEmail(string $email)
Validates the structure of an email address and checks MX DNS records.
static bool
validateIsbn(string $isbn)
Validates an ISBN-10 or ISBN-13 format and checksum.
static bool
validateLoanCode(string $code)
Validates a loan code in the format LNXXXXXXXX.
Accepts both the full code (LN + 8 alphanumeric characters) or partial prefixes (for autocomplete use cases).