respect-validation/docs/rules/StartsWith.md
Danilo Correa 18bdd399d7
Apply contribution guidelines to "StartsWith" rule
After writing the integration tests of the "StartsWith" rule we noticed
that it is generating extra parentheses for the "{{startValue}}"
template placeholder.

This commit will also remove those extra parentheses.

Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
2019-03-10 18:07:39 +01:00

768 B

StartsWith

  • StartsWith(mixed $value)
  • StartsWith(mixed $value, bool $identical)

Validates whether the input starts with a given value.

This validator is similar to Contains, but validates only if the value is at the beginning of the input.

For strings:

v::startsWith('lorem')->validate('lorem ipsum'); // true

For arrays:

v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true

true may be passed as a parameter to indicate identical comparison instead of equal.

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

Changelog

Version Description
0.3.9 Created

See also: