Installation
Valicomb is a simple, minimal PHP validation library with zero dependencies. Completely rewritten for PHP 8.2+ with security-first design, strict type safety, and modern PHP features.
Requirements
Section titled “Requirements”- PHP 8.2 or higher
ext-mbstringextension
Installation
Section titled “Installation”Install Valicomb using Composer:
composer require frostybee/valicombOptional Extensions
Section titled “Optional Extensions”- For high-precision numeric comparisons, consider installing the BCMath extension. If you are comparing floating-point numbers with
min/maxvalidators, BCMath provides greater accuracy and reliability. Valicomb will automatically use it if available.
Features
Section titled “Features”- Modern PHP 8.2+ support with strict types turned on, so everything is fully typed and predictable.
- Security-first approach that helps guard against things like ReDoS, type juggling issues, path traversal, and similar problems.
- Thoroughly tested, with over 430 tests making sure things behave the way they should.
- No external dependencies, other than the standard
ext-mbstringextension. - Clean and straightforward API that’s easy to read and chain together.
- Built-in i18n support, offering 33 languages out of the box.
- 54 ready-to-use validation rules covering the most common validation needs.
- Easy to extend, so you can add your own custom validation rules when needed.
- Clean, modern codebase, fully passing PHPStan Level 8 checks.
Quick Example
Section titled “Quick Example”use Frostybee\Valicomb\Validator;
$v = new Validator(['email' => 'test@example.com', 'age' => '25']);$v->rule('required', ['email', 'age']);$v->rule('email', 'email');$v->rule('integer', 'age');
if ($v->validate()) { echo "Validation passed!";} else { print_r($v->errors());}What’s Next?
Section titled “What’s Next?”- Quick Start - Learn the basics
- Core Concepts - Understand how validation works
- Defining Rules - Master the three rule syntaxes
- Validation Rules - Explore all 54 built-in rules