PHPackages                             tiny-talk-messages/validation - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. tiny-talk-messages/validation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

tiny-talk-messages/validation
=============================

A lightweight, type-safe validation library for PHP 8.3+

v1.0.0(1y ago)01MITPHPPHP ^8.3

Since Apr 28Pushed 1y agoCompare

[ Source](https://github.com/tiny-talk-messages/validation)[ Packagist](https://packagist.org/packages/tiny-talk-messages/validation)[ RSS](/packages/tiny-talk-messages-validation/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

TinyTalkMessages Validation
===========================

[](#tinytalkmessages-validation)

A lightweight, type-safe validation library for PHP 8.3+ focused on simple error declaration and extensible validation rules.

Features
--------

[](#features)

- **Object-based error declaration:** Use `ErrorField` to represent specific validation errors.
- **Error collection:** Gather multiple errors in a single `Errors` collection.
- **Extensible interfaces:** Create your own rules and validators with core interfaces.
- **Minimal dependencies:** Requires only PHP, making it suitable for any PHP project.

Requirements
------------

[](#requirements)

- PHP ^8.3
- (\[For Development/Testing\] PHPUnit ^12.1)

Installation
------------

[](#installation)

Install via Composer:

```
composer require tiny-talk-messages/validation
```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
use TinyTalkMessages\Validation\Data\ErrorField;
use TinyTalkMessages\Validation\Data\Errors;

$errors = new Errors();
$errors->add(new ErrorField('email', 'This value is not a valid email.'));
$errors->add(new ErrorField('password', 'Password is too short.'));

// Handle errors
if (count($errors) > 0) {
    foreach ($errors as $error) {
        echo $error->field . ': ' . $error->message . PHP_EOL;
    }
}
```

### Error Organization

[](#error-organization)

The `Errors` collection allows you to accumulate errors and propagate them through validation layers. Each error references its associated field, making integration with forms or APIs simple.

### Custom Rules &amp; Validators

[](#custom-rules--validators)

You can implement your own logic by creating classes that follow these interfaces:

- `RuleInterface` – For individual validation rules.
- `ValidatorInterface` – For complex validators.

Refer to the `src/Interfaces` directory for the interface definitions.

Project Structure
-----------------

[](#project-structure)

```
src/
  Data/
    ErrorField.php         # Field-specific validation error
    Errors.php             # Error collection class
  Interfaces/
    RuleInterface.php      # Interface for custom rules
    ValidatorInterface.php # Interface for validators
examples/                  # Implementation examples
  hooked-rule-validation.php
  rules.php
  validator.php

```

Running Tests
-------------

[](#running-tests)

To install development dependencies and run the tests:

```
composer install
composer test
```

Code Examples
-------------

[](#code-examples)

A rich set of usage examples is available in the [`examples/`](./examples/) directory:

- [rules.php](./examples/rules.php) – Examples of custom validation rule implementations (like Email and OptionalEmail).
- [validator.php](./examples/validator.php) – Example of a custom validator and working with the error collection.
- [hooked-rule-validation.php](./examples/hooked-rule-validation.php) – Example with a "hooked rule" and integration of validation errors into the validator interface.

We recommend reviewing these examples for a better understanding of the library's structure and extensibility.

Why Use This Package?
---------------------

[](#why-use-this-package)

- **Minimalist:** Focuses only on error declaration and validation abstraction.
- **Type Safety:** Designed for strong typing and reliability.
- **Framework-Agnostic:** Integrates easily with any PHP framework or standalone scripts.
- **Extensible:** Easily extendable to fit custom validation needs.

Feedback &amp; Contributions
----------------------------

[](#feedback--contributions)

Questions or suggestions? Open an issue or submit a pull request!

---

**License:** MIT

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance48

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

385d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/68982eb41712cacbe2d2c182399a65e9238200228b23df6470d3fe0c9bce193e?d=identicon)[vesh95](/maintainers/vesh95)

---

Top Contributors

[![vesh95](https://avatars.githubusercontent.com/u/16884979?v=4)](https://github.com/vesh95 "vesh95 (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tiny-talk-messages-validation/health.svg)

```
[![Health](https://phpackages.com/badges/tiny-talk-messages-validation/health.svg)](https://phpackages.com/packages/tiny-talk-messages-validation)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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