Skip to content

Built-In Validators

These validators are all in the Centum\Validator namespace.

Alpha

Checks if a value is an alphabetic string (no numbers, spaces, or punctuation).

Alphanumeric

Checks if a value is an alphanumeric string.

Base64

Checks if a value is a valid base64 string.

Callback

Checks a value against a callback function. Allows custom Validators to be wrapped within a callable.

CommandSlug

Checks if a value is a Command slug (i.e. all lowercase, alphanumeric with dashes and colons, starting and ending with a letter or number).

This differs from Slug in that colons are also allowed.

EmailAddress

Checks if a value is a valid email address.

InArray

Checks if a value is in an array of values.

LanguageCode

Checks if a value is a valid ISO language code.

NotEmpty

Checks if a value is not empty.

NotInArray

Checks if a value is not in an array of values.

RegularExpression

Checks if a value matches a regular expression.

Slug

Checks if a value is a slug (i.e. all lowercase, alphanumeric with dashes, starting and ending with a letter or number).

TimeZone

Checks if a value is a valid time zone identifier.

Type\IsA

Checks if a value is an instance of a particular class.

Type\IsArray

Checks if a value is an array.

Type\IsBoolean

Checks if a value is a boolean.

Type\IsCallable

Checks if a value is a callable.

Type\IsCharacter

Checks if a value is a single character.

Type\IsCountable

Checks if a value is countable.

Type\IsInstanceOf

Checks if a value is an instance of a particular object.

Type\IsInteger

Checks if a value is an integer or an integer string.

Type\IsIterable

Checks if a value is iterable.

Type\IsNull

Checks if a value is null.

Type\IsObject

Checks if a value is an object.

Type\IsResource

Checks if a value is a resource.

Type\IsScalar

Checks if a value is a scalar.

Type\IsString

Checks if a value is a string.

ZipCode

Checks if a value is a valid US zip code (either in the form of 12345 or 12345-6789).