Search by

kongono / validation

anthonyiovanna

Kongono v1 zero-bloat PHP 8.5 attribute-driven readonly DTO validator (nested DTOs, BackedEnum, ArrayOf, custom RuleInterface).

v1.25.0 2026-11-26 18:20 UTC

This package is auto-updated.

Last update: 2026-11-28 14:51:25 UTC


README

Read-only subtree split of kongono/framework. Open issues and pull requests in the main monorepo.

Zero-bloat, strict PHP 8.5.13+ attribute-driven readonly DTO validator supporting nested DTOs, BackedEnum, #[ArrayOf], #[Required], #[Email], #[Uuid], #[Min], #[Max], #[Between], #[Date], #[Ip], #[In], #[NotIn], #[Regex], #[RequiredIf], #[Confirmed], custom RuleInterface, and ValidatableDtoInterface.

Installation

composer require kongono/validation

Example

<?php

declare(strict_types=1);

use Kongono\Validation\Attributes\{Email, Max, Min, Required};
use Kongono\Validation\Validator;

final readonly class CreateUserInput
{
    public function __construct(
        #[Required, Min(2), Max(80)]
        public string $name,
        #[Required, Email]
        public string $email,
    ) {}
}

$dto = (new Validator())->validateDto(CreateUserInput::class, [
    'name' => 'Aoi',
    'email' => 'aoi@example.com',
]);

Documentation & License