Download the PHP package laurynasgadl/php-validator without Composer
On this page you can find all versions of the php package laurynasgadl/php-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laurynasgadl/php-validator
More information about laurynasgadl/php-validator
Files in laurynasgadl/php-validator
Package php-validator
Short Description Array value validation library for PHP
License MIT
Informations about the package php-validator
PHP-Validator
inspired by Laravel's form validation
Installation
composer require laurynasgadl/php-validator
Documentation
Rules
Custom rules
You can also register the rule to be able to use it as a string:
Existing rules
array
: the value needs to be an array
between:{from_size},{to_size}
: the value needs to be between the given range
float
: the value needs to be a float
integer
: the value needs to be an integer
max:{max_size}
: the value needs to be less or equal to the given amount
min:{min_size}
: the value needs to be greater or equal to the given amount
required
: the parameter needs to exist in the data set
required_with:{param_1}...
: the parameter needs to exist in the data set if all the other parameters exist
required_without:{param_1}...
: the parameter needs to exist in the data set if one of the other parameters do not exist
size
: the size of the value needs to be equal to the given amount. The size of a string is its length, the size of an array is the number of elements inside it, the size of a boolean is 0 or 1.
string
: the value needs to be a string
boolean
: the value needs to be a boolean
numeric
: the value needs to be a numeric
default:{value}
: the rule will always be applied first, meaning, params can successfully pass required
rules even if their value is not set or is null
alpha_dash
: the value can only be made up of uppercase and lowercase letters, numbers and -
or _
symbols
alpha_numeric
: the value can only be made up of uppercase and lowercase letters and numbers
regex:{pattern}
: the value needs to match the given pattern
email
: the value needs to be an email
url
: the value needs to start with http://
or https://
and only contain URL-valid symbols
ip
: the value needs to be an IP address
Custom messages
You can set custom validation messages either via the Validator constructor or the validate
method: