Reference

V::minWords()

Checks if the number of words in the value equals or is below the given maximum

V::minWords(string $value, $min): bool

Parameters

Name Type Default Description
$value string
$min mixed

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

Source code

kirby/src/Toolkit/V.php#L359