Back to Validation

BoolVal

docs/validators/BoolVal.md

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

BoolVal

  • BoolVal()

Validates if the input results in a boolean value:

php
v::boolVal()->assert('on');
// Validation passes successfully

v::boolVal()->assert('off');
// Validation passes successfully

v::boolVal()->assert('yes');
// Validation passes successfully

v::boolVal()->assert('no');
// Validation passes successfully

v::boolVal()->assert(1);
// Validation passes successfully

v::boolVal()->assert(0);
// Validation passes successfully

Templates

BoolVal::TEMPLATE_STANDARD

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

Template placeholders

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

Categorization

  • Booleans
  • Types

Changelog

VersionDescription
1.0.0Created

See Also