PHPackages                             mewtonium/vanguard - 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. mewtonium/vanguard

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

mewtonium/vanguard
==================

A simple validation library using PHP attributes.

v1.0.1(10mo ago)02MITPHPPHP &gt;=8.3CI passing

Since Mar 15Pushed 10mo ago1 watchersCompare

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

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

Vanguard - PHP Attribute-Based Validation Library
=================================================

[](#vanguard---php-attribute-based-validation-library)

Caution

🛑 This package is intended for demo purposes only and is **not** suitable for production use. Please do not use it in live or production environments. 🛑

Vanguard is a simple, attribute-based validation library for PHP, providing a clean and easy way to validate data using attributes on class properties.

Features
--------

[](#features)

- Simple attribute-based validation.
- Dependency-free - no external libraries required.
- Supports common validation rules, with more to be added in future.
    - **Comparison and range-based rules** (`Between`, `GreaterOrEqual`, `GreaterThan`, `LessOrEqual`, `LessThan`) also validate strings as dates when applicable.
    - `Equal` can check strings as either a date string, or a standard value.
- Supports for a custom error message on any rule.

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

[](#installation)

```
composer require mewtonium/vanguard
```

Usage
-----

[](#usage)

Add the `Vanguard` trait to any class, add a few `Rule` attributes to properties and call `validate()` - simple!

```
