docs/messages/placeholder-pipes.md
Validation uses StringFormatter to render validation messages. Placeholder pipes allow you to customize how values are rendered by adding a pipe (|) followed by a modifier name to your placeholder.
To use a placeholder pipe, modify your placeholder like this: {{placeholder|modifier}}
v::templated(
'The {{field|raw}} field is required',
v::notEmpty(),
['field' => 'email'],
)->assert('');
// → The email field is required
// (instead of: The "email" field is required)
Validation supports all modifiers from StringFormatter except StringPassthroughModifier. For detailed documentation on each modifier, see the StringFormatter Modifiers documentation.
// Using with assert()
v::email()->assert($input, 'The {{field|raw}} must be valid', ['field' => 'email']);
// Using with Templated validator
v::templated(
'The {{field|raw}} must be valid',
v::email(),
['field' => 'email']
)->assert($input);
// Using list modifiers
v::templated(
'Status must be {{haystack|list:or}}',
v::in(['active', 'pending', 'archived']),
)->assert('deleted');
// → Status must be "active", "pending", or "archived"