Back to Validation

Slug

docs/validators/Slug.md

3.1.11.3 KB
Original Source
<!-- SPDX-License-Identifier: MIT SPDX-FileCopyrightText: (c) Respect Project Contributors SPDX-FileContributor: Alexandre Gomes Gaigalas <[email protected]> SPDX-FileContributor: Danilo Correa <[email protected]> SPDX-FileContributor: Henrique Moody <[email protected]> -->

Slug

  • Slug()

Validates whether the input is a valid slug.

php
v::slug()->assert('my-wordpress-title');
// Validation passes successfully

v::slug()->assert('my-wordpress--title');
// → "my-wordpress--title" must be a slug

v::slug()->assert('my-wordpress-title-');
// → "my-wordpress-title-" must be a slug

Templates

Slug::TEMPLATE_STANDARD

ModeTemplate
default{{subject}} must be a slug
inverted{{subject}} must not be a slug

Template placeholders

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

Categorization

  • Strings

Changelog

VersionDescription
3.0.0Templates changed
0.3.9Created

See Also