respect-validation/docs/rules/Directory.md
Henrique Moody 48405271c5
Replace placeholder "name" with "subject"
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
2025-12-26 21:30:01 +01:00

1.4 KiB

Directory

  • Directory()

Validates if the given path is a directory.

v::directory()->isValid(__DIR__); // true
v::directory()->isValid(__FILE__); // false

This validator will consider SplFileInfo instances, so you can do something like:

v::directory()->isValid(new SplFileInfo('library/'));
v::directory()->isValid(dir('/'));

Templates

Directory::TEMPLATE_STANDARD

Mode Template
default {{subject}} must be a directory
inverted {{subject}} must not be a directory

Template placeholders

Placeholder Description
subject The validated input or the custom validator name (if specified).

Categorization

  • File system

Changelog

Version Description
2.0.0 Validates PHP's Directory class
0.4.4 Created

See also: