Download the PHP package qdenka/easyvalidation without Composer
On this page you can find all versions of the php package qdenka/easyvalidation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download qdenka/easyvalidation
More information about qdenka/easyvalidation
Files in qdenka/easyvalidation
Package easyvalidation
Short Description EasyValidation โ a package for simple, fast, and extendable data validation (email, URL, number, date, credit card, IP, phone, etc.).
License MIT
Homepage https://github.com/qdenka/easyvalidation
Informations about the package easyvalidation
EasyValidation
EasyValidation is a lightweight PHP library for validating common data types. Built with DDD, SOLID, and DRY principles, it offers both a factory-based API and convenient static helper methods.
๐ Table of Contents
- โจ Features
- โ๏ธ Requirements
- ๐ Installation
-
๐ ๏ธ Usage
- Factory API
- Static Helpers
- ๐ Available Validators
- โ๏ธ Configuration
- ๐งฉ Extending
- ๐งช Testing
- ๐ค Contributing
- ๐ License
โจ Features
- โ Validate emails (standard, Gmail-only, disposable)
- โ Validate URLs, numbers, dates
- โ Validate IPs (IPv4 & IPv6)
- โ Validate UUIDs (v1โv5)
- โ Validate JSON and Base64 strings
- โ Validate international phone numbers (E.164)
- ๐ฆ PSR-4 autoloading
- ๐ Factory-based API + static helpers
- โ๏ธ Easily extendable with new validators
โ๏ธ Requirements
- PHP ^7.4 || ^8.0
๐ Installation
Install with Composer:
Autoloading is configured via PSR-4 (QDenka\EasyValidation\).
๐ ๏ธ Usage
Factory API
Use ValidatorFactory to retrieve any validator by its type key:
Static Helpers
For quick checks, use the Validator facade:
๐ Available Validators
| Type | Static Helper | Description |
|---|---|---|
email |
isValidEmail() |
RFC-compliant email |
google_email |
isGoogleMail() |
Gmail & Googlemail domains |
disposable_email |
isDisposableEmail() |
Blacklisted disposable domains |
url |
isValidUrl() |
HTTP/HTTPS URLs |
number |
isValidNumber() |
Numeric values |
date |
isValidDate() |
Date in Y-m-d (configurable format) |
ip |
isValidIp() |
IPv4 & IPv6 addresses |
uuid |
isValidUuid() |
UUID v1โv5 |
json |
isValidJson() |
JSON string parsing |
base64 |
isValidBase64() |
Base64-encoded data |
phone |
isValidPhone() |
International E.164 phone numbers |
โ๏ธ Configuration
Disposable Domains List
Customize disposable email domains by editing config/disposable_domains.php:
Ensure all domains are lowercase.
๐งฉ Extending
To add a new validator:
- Implement
ValidatorInterfaceinsrc/Domain/YourType/YourValidator.php. - Register your class in
ValidatorFactory(src/Application/Validators/ValidatorFactory.php). - (Optional) Add a static helper in
Validatorfacade (src/Infrastructure/Factories/Validator.php). - Write tests under
tests/following existing patterns.
๐งช Testing
Run PHPUnit:
All tests must pass before merging.
๐ค Contributing
- Fork repository
- Create a feature branch (
git checkout -b feature/NewValidator) - Commit changes (
git commit -m 'Add NewValidator') - Push (
git push origin feature/NewValidator) - Open a Pull Request
Follow PSR-12 coding standards and include tests.
๐ License
This project is licensed under the MIT License. See LICENSE for details.