respect-validation/docs/rules/Max.md
Henrique Moody 52614d600d
Organize documentation for "Read the Docs"
The current documentation is hosted via GitHub pages rendered by
"Couscous". Every time we need a new version of the documentation
published we need to manually execute the "couscous".

This commit reorganize the documentation to be published to
"Read the Docs" because it will also allow us to have documentations per
version of the library most importantly provider a search field for the
documentation.

The documentation will be then published on:
https://respect-validation.readthedocs.io/

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-23 01:59:39 +02:00

731 B

Max

  • v::max(mixed $maxValue)
  • v::max(mixed $maxValue, boolean $inclusive = true)

Validates if the input doesn't exceed the maximum value.

v::intVal()->max(15)->validate(20); // false
v::intVal()->max(20)->validate(20); // false
v::intVal()->max(20, true)->validate(20); // true

Also accepts dates:

v::date()->max('2012-01-01')->validate('2010-01-01'); // true

Also date intervals:

// Same of minimum age validation
v::date()->max('-18 years')->validate('1988-09-09'); // true

true may be passed as a parameter to indicate that inclusive values must be used.

Message template for this validator includes {{maxValue}}.


See also: