Norvica [Validation]

A simple and extensible PHP validation library

Get Started →

Validate Scalar Values

Validate single values such as strings, numbers, booleans.

$validator->validate(
    value: '[email protected]',
    rules: new Email(),
);

Learn more about scalar values validation →

Validate Arrays

Validate arrays of data, applying rules to individual elements.

$validator->validate(
    value: ['email' => '[email protected]'],
    rules: ['email' => new Email()],
);

Learn more about array validation →

Validate Objects

Validate data objects, ensuring that their properties conform to specific rules.

readonly class SomeDto {
    public function __construct(
        #[Email]
        public string $email,
    ) {}
}

$validator->validate(
    value: new SomeDto(email: '[email protected]'),
);

Learn more about object validation →

Validate Collections

Validate collections of values.

$validator->validate(
    value: ['127.0.0.1', '0.0.0.0'],
    rules: new EachX(new Ip()),
);

Learn more about collection validation →