PHPackages                             qdenka/easyvalidation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. qdenka/easyvalidation

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

qdenka/easyvalidation
=====================

EasyValidation — a package for simple, fast, and extendable data validation (email, URL, number, date, credit card, IP, phone, etc.).

1.1(3mo ago)31MITPHPPHP &gt;=7.4CI passing

Since May 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/QDenka/EasyValidation)[ Packagist](https://packagist.org/packages/qdenka/easyvalidation)[ Docs](https://github.com/qdenka/easyvalidation)[ RSS](/packages/qdenka-easyvalidation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (5)Used By (0)

EasyValidation
==============

[](#easyvalidation)

[![Latest Stable Version](https://camo.githubusercontent.com/e1f669e681376124522176f86ee09064d5e333f1d7a72c9d58d0a6b0bdafd2c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7164656e6b612f6561737976616c69646174696f6e)](https://packagist.org/packages/qdenka/easyvalidation) [![License](https://camo.githubusercontent.com/4d6ec7a76bb3d6ebaded85173d65d9259b4c3924edf204daced0559c0ba48fab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7164656e6b612f6561737976616c69646174696f6e)](LICENSE) ![Total Downloads](https://camo.githubusercontent.com/5437a7c09c4dc7cf093b33ce6d24614ed5ab1d148aed529a62ec92ae4601c67e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7164656e6b612f6561737976616c69646174696f6e)

**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
-------------------

[](#-table-of-contents)

- [✨ Features](#-features)
- [⚙️ Requirements](#%EF%B8%8F-requirements)
- [🚀 Installation](#-installation)
- [🛠️ Usage](#%EF%B8%8F-usage)

    - [Factory API](#factory-api)
    - [Static Helpers](#static-helpers)
- [📑 Available Validators](#-available-validators)
- [⚙️ Configuration](#%EF%B8%8F-configuration)
- [🧩 Extending](#-extending)
- [🧪 Testing](#-testing)
- [🤝 Contributing](#-contributing)
- [📄 License](#-license)

---

✨ Features
----------

[](#-features)

- ✅ Validate emails (standard, Gmail-only, disposable)
- ✅ Validate URLs, numbers, dates
- ✅ Validate IPs (IPv4 &amp; 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
---------------

[](#️-requirements)

- PHP ^7.4 || ^8.0

---

🚀 Installation
--------------

[](#-installation)

Install with Composer:

```
composer require qdenka/easyvalidation
```

Autoloading is configured via PSR-4 (`QDenka\EasyValidation\`).

---

🛠️ Usage
--------

[](#️-usage)

### Factory API

[](#factory-api)

Use `ValidatorFactory` to retrieve any validator by its type key:

```
use QDenka\EasyValidation\Application\Validators\ValidatorFactory;

$types = ['email','google_email','disposable_email','url','number','date','ip','uuid','json','base64','phone'];
foreach ($types as $type) {
    $validator = ValidatorFactory::create($type);
    $value = 'test_value_for_' . $type;
    if ($validator && $validator->validate($value)) {
        echo "[$type] valid\n";
    } else {
        echo "[$type] invalid\n";
    }
}
```

### Static Helpers

[](#static-helpers)

For quick checks, use the `Validator` facade:

```
use QDenka\EasyValidation\Infrastructure\Factories\Validator;

if (Validator::isValidEmail('user@example.com')) {
    echo "Valid email";
}

if (Validator::isGoogleMail('user@gmail.com')) {
    echo "It's a Gmail address";
}

if (Validator::isDisposableEmail('temp@mailinator.com')) {
    echo "Disposable email detected";
}

// Other helpers:
Validator::isValidUrl('https://example.com');
Validator::isValidNumber('123.45');
Validator::isValidDate('2023-04-23');
Validator::isValidIp('2001:db8::1');
Validator::isValidUuid('550e8400-e29b-41d4-a716-446655440000');
Validator::isValidJson('{"foo":1}');
Validator::isValidBase64(base64_encode('hello'));
Validator::isValidPhone('+1234567890');
```

---

📑 Available Validators
----------------------

[](#-available-validators)

TypeStatic HelperDescription`email``isValidEmail()`RFC-compliant email`google_email``isGoogleMail()`Gmail &amp; 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 &amp; 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
----------------

[](#️-configuration)

### Disposable Domains List

[](#disposable-domains-list)

Customize disposable email domains by editing `config/disposable_domains.php`:

```
return [
    'mailinator.com',
    '10minutemail.com',
    // add your domains here
];
```

Ensure all domains are lowercase.

---

🧩 Extending
-----------

[](#-extending)

To add a new validator:

1. Implement `ValidatorInterface` in `src/Domain/YourType/YourValidator.php`.
2. Register your class in `ValidatorFactory` (`src/Application/Validators/ValidatorFactory.php`).
3. (Optional) Add a static helper in `Validator` facade (`src/Infrastructure/Factories/Validator.php`).
4. Write tests under `tests/` following existing patterns.

---

🧪 Testing
---------

[](#-testing)

Run PHPUnit:

```
vendor/bin/phpunit --colors
```

All tests must pass before merging.

---

🤝 Contributing
--------------

[](#-contributing)

1. Fork repository
2. Create a feature branch (`git checkout -b feature/NewValidator`)
3. Commit changes (`git commit -m 'Add NewValidator'`)
4. Push (`git push origin feature/NewValidator`)
5. Open a Pull Request

Follow PSR-12 coding standards and include tests.

---

📄 License
---------

[](#-license)

This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance82

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~269 days

Total

2

Last Release

98d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3339fb58d7742b5f4ce6a647b09c74739d28b9ecfc85ffb5de6d2f04b6985b82?d=identicon)[qdenka](/maintainers/qdenka)

---

Top Contributors

[![QDenka](https://avatars.githubusercontent.com/u/77678360?v=4)](https://github.com/QDenka "QDenka (15 commits)")[![denkaq](https://avatars.githubusercontent.com/u/125537746?v=4)](https://github.com/denkaq "denkaq (3 commits)")

---

Tags

urlvalidationemailphonedateregexIPcreditcardnumber

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/qdenka-easyvalidation/health.svg)

```
[![Health](https://phpackages.com/badges/qdenka-easyvalidation/health.svg)](https://phpackages.com/packages/qdenka-easyvalidation)
```

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[dominicsayers/isemail

Checks an email address against the following RFCs: 3696, 1123, 4291, 5321, 5322

308134.4k3](/packages/dominicsayers-isemail)[arubacao/tld-checker

Top Level Domain (TLD) validation library for PHP

721.6M2](/packages/arubacao-tld-checker)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[kickbox/kickbox

Official kickbox API library client for PHP

591.0M4](/packages/kickbox-kickbox)[neverbounce/neverbounce-php

This package provides convenient methods to integrate the NeverBounce API into your project.

241.1M3](/packages/neverbounce-neverbounce-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
