Valitron

Simple, elegant, dependency-free validation for PHP.

Library
Composer
vv1.4.11
1,606stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
48/100Fair
Development Activity0
Maintenance20
Community84
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture72
Code Quality78
Innovation64
Learning Curve82

Valitron is a standalone PHP validation library with no external dependencies and a focus on readable, concise syntax. You define an array of rules against your data and get back a clear pass/fail result with structured error messages.

It ships dozens of built-in rules — required fields, lengths, formats, dates, comparisons, and more — plus support for custom rules, conditional validation, field labels, and translated error messages, making it a pragmatic choice for validating request payloads and form input.

What You Get

  • A dependency-free validator with a chainable, readable API
  • Dozens of built-in rules for formats, lengths, dates, and comparisons
  • Custom rule registration and conditional/optional validation
  • Field labeling and translated error messages in many languages

Common Use Cases

  • Validating HTTP request or form input in a PHP application
  • Enforcing business rules on data before persistence
  • Producing localized, user-facing validation error messages

Under The Hood

Architecture - Nearly all logic lives in a single Validator class that holds the data, an accumulated rule set, labels, and a language/translation map. Rules are stored as callables (built-in methods prefixed validate* or user-registered closures) and executed in validate(), collecting failures into a per-field error array formatted through message templates. Tech Stack - Plain PHP with zero runtime dependencies; language files provide translated messages, and the test suite runs under PHPUnit via GitHub Actions. Code Quality - Well-tested with a long-standing CI pipeline and broad rule coverage; the monolithic validator is large but consistently structured. API Design - Deliberately terse and readable — $v = new Validator($data); $v->rule('required', 'name'); $v->validate(); — with array-based rule declaration and fluent chaining for more complex cases.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search