Skip to content

Kirby 6.0.0

minWords

Checks if the number of words in the value equals or is greater the given minimum

V::minWords(string|null $value, mixed $min): bool

Parameters

Name Type Default
$value stringornull no default value
$minrequired mixed no default value

Return type

bool

In your code

if (V::minWords('Lorem ipsum dolor sit amet.', 5)) {
  echo 'Yay, valid!';
}

In fields

fields:
  example:
    label: Example field
    type: text
    validate:
      minWords: 5