Teki
Rules

Boolean

Validate boolean fields with true or false expectations.

Use bool("field") for boolean fields.

Teki schema = Teki.fromRules(
    bool("termsAccepted").isTrue(),
    bool("archived").isFalse()
);

Available methods

MethodPurpose
required()Reject missing values
optional()Skip validation when the value is missing
isTrue()Require the value to be true
isFalse()Require the value to be false
custom(Rule)Attach a custom rule

Notes

bool(...) is for explicit boolean assertions, such as requiring a terms checkbox to be accepted.

On this page