IterableVal

February 3, 2026 ยท View on GitHub

  • IterableVal()

Validates whether the input is an iterable value, in other words, if you can iterate over it with the foreach language construct.

v::iterableVal()->assert([]);
// Validation passes successfully

v::iterableVal()->assert(new ArrayObject());
// Validation passes successfully

v::iterableVal()->assert(new stdClass());
// Validation passes successfully

v::iterableVal()->assert('string');
// โ†’ "string" must be iterable

Note

This validator doesn't behave as PHP's is_iterable() function because it considers that you can iterate over any object.

Templates

IterableVal::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be iterable
inverted{{subject}} must not be iterable

Template placeholders

PlaceholderDescription
subjectThe validated input or the custom validator name (if specified).

Categorization

  • Types

Changelog

VersionDescription
3.0.0Templates changed
3.0.0Renamed from IterableType to IterableVal
1.0.8Renamed from Iterable to IterableType
1.0.0Created as Iterable

See Also