Download the PHP package maplephp/validate without Composer
On this page you can find all versions of the php package maplephp/validate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maplephp/validate
More information about maplephp/validate
Files in maplephp/validate
Package validate
Short Description User-friendly input validation library.
License Apache-2.0
Homepage https://wazabii.se
Informations about the package validate
MaplePHP - Validation
MaplePHP - Validation is a lightweight and powerful PHP library designed to simplify the validation of various data inputs. Whether you're verifying if a value is a valid email or phone number, ensuring string lengths, or performing more advanced checks like credit card numbers and dates, MaplePHP - Validation offers a comprehensive and intuitive approach. With its wide range of built-in validators and simple syntax, it makes handling complex validation tasks easier, leading to cleaner and more reliable code.
Installation
Initiation
You will always initiate an instance with the static method _val followed by a value you want to validate.
Validations
Required field
Check if there is any value (even if it's 0)
Check string length (min, max)
-
Min only:
- Min and Max:
Check if string has an exact length
Check if value equals or not equals another value
-
Equals:
- Not equals:
Validate if it's a valid email
Validate if it's a valid phone number
Allows numbers and special characters ("-", "+", " ").
Validate Swedish personal number (personnummer)
Validate Swedish organization number
Validate credit card number
Validate VAT number
Check if value is a valid float
Check if value is a valid integer
Check if value is a valid number (numeric)
Check if value is positive or negative
-
Positive:
- Negative:
Check if value is a valid version number
Compare version with another version
Validate password (lossy or strict)
-
Lossy password (minimum character set):
- Strict password (requires at least one lowercase, uppercase, digit, and special character):
Validate if value is string and contains only A-Z
-
Both cases:
-
Lowercase only:
- Uppercase only:
Check if it's a valid hex color code
Check if it's a valid date
Check if it's a valid date and time
Check if it's a valid time
Check if someone is at least a certain age
Check if it's a valid domain name
Check if it's a valid URL (http/https is required)
Check if it's a valid DNS entry
Validate file and directory properties
-
Check if it's a valid file:
-
Check if it's a directory:
-
Check if it's writable:
- Check if it's readable:
Validate ZIP code (with custom length)
Validate if value matches a pattern (regex)
Validate if value is an array, object, or resource
-
Array:
-
Object:
- Resource:
Validate if value is boolean or interpretable as a boolean
-
Is Boolean:
- Is Boolean-like value (e.g., "yes", "no", "1", "0"):
Validate using multiple methods (one or all must match)
-
Validate if one method passes:
- Validate if all methods pass: