Download the PHP package rohit-sagar/validatorplus without Composer
On this page you can find all versions of the php package rohit-sagar/validatorplus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rohit-sagar/validatorplus
More information about rohit-sagar/validatorplus
Files in rohit-sagar/validatorplus
Package validatorplus
Short Description A simple light-weight php validator package
License MIT
Informations about the package validatorplus
ValidatorPlus
ValidatorPlus is a lightweight, chainable validation package built in PHP — perfect for console applications, CLI tools, or any PHP project where you want custom and clean validation without relying on full-stack frameworks.
This package was created while learning Composer, design patterns, and package publishing — and has been structured to be extensible, testable, and easy to use.
Installation
Why Use ValidatorPlus?
- Built using real design patterns (Chain of Responsibility, Strategy)
- Fully chainable syntax for rules
- Supports label (alias) for human-friendly error messages
- Fully tested using PHPUnit
- Easily extendable — add your own rules in seconds
- Designed for clarity and learning — perfect for devs who want to understand how validation works under the hood
Quick Example
Output
Available Rules (So far)
| Rule | Description |
|---|---|
| required | Field must be present and not empty |
| min:x | Minimum string length |
| max:x | Maximum string length |
| Must be a valid email address |
You can chain as many rules as you like on any field.
Add Your Own Rule
You can define custom rules using the provided RuleInterface.
Use it in validation
This approach allows you to add as many custom rules as you want no need to modify the core.
Aliases / Labels
Use .label() to define a human-readable name for a field, which is reflected in error messages:
Error will say The Email Address field is required.
Testing
This package includes tests using PHPUnit.
You can add more tests to the tests/ folder to ensure coverage of all your custom rules and logic.
Structure:
Notes
This library was built as a learning project and is designed to be easy to read and extend. You are encouraged to:
- Create and share your own rules
- Fork and improve it further
- Use it in CLI tools or simple web backends
If you’re learning design patterns, open the source and explore how each part connects. The code is your teacher.
License
MIT — use it freely in personal or commercial projects.