PHPackages                             alksily/validator - 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. [Framework](/categories/framework)
4. /
5. alksily/validator

ActiveLibrary[Framework](/categories/framework)

alksily/validator
=================

The Validator component provides tools to validate values.

1.2(6y ago)0333MITPHPPHP &gt;=7.0

Since Mar 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/alksily/validator)[ Packagist](https://packagist.org/packages/alksily/validator)[ Docs](https://github.com/alksily/validator)[ RSS](/packages/alksily-validator/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (9)Used By (0)

Validator Component
===================

[](#validator-component)

The Validator component provides tools to validate values.

#### Requirements

[](#requirements)

- PHP &gt;= 7.0

#### Installation

[](#installation)

Run the following command in the root directory of your web project:

> `composer require alksily/validator`

#### Usage

[](#usage)

```
use Alksily\Validator\Filter;
use Alksily\Validator\Traits\FilterRules;

class UserFilter extends Filter
{
    use FilterRules;

    // check data for create new user
    public static function add(array &$data = [])
    {
        $filter = new self($data);

        $filter
            ->addGlobalRule($filter->leadEscape()) // global rule for all fields in $data
            ->addGlobalRule($filter->leadTrim())
            ->attr('username')
                ->addRule($filter->checkStrlenMax(20)) // parameter passing for checking
                ->addRule($filter->checkStrlenMin(3))
            ->attr('password')
                ->addRule($filter->checkStrlenBetween(3, 20))
            ->attr('password_again')
                ->addRule($filter->checkEqualToField('password'), 'Passwords do not match') // second arg is reason error
            ->attr('email')
                ->addRule($filter->checkEmail())
            ->attr('ip')
                ->addRule($filter->checkIp());

        return $filter->run();
    }
}

// data example
$data = [
    'username'       => 'Aleksey',
    'password'       => 'MyPassword',
    'password_again' => 'MyPassword',
    'email'          => 'aleksey@example.com',
    'ip'             => '127.0.0.1',
];

$result = UserFilter::add($data);

if ($result === true) {
    // check ok
    var_dump($data); // sanitized data
} else {
    // found an error
    var_dump($result);
}
```

Example error when password do not match

```
array(1) {
  ["password_again"]=>
  string(22) "Passwords do not match"
}

```

#### Contributing

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

#### License

[](#license)

The Alksily Validator is licensed under the MIT license. See [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~56 days

Recently: every ~98 days

Total

8

Last Release

2230d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5148853?v=4)[Aleksey Ilyin](/maintainers/alksily)[@alksily](https://github.com/alksily)

---

Top Contributors

[![alksily](https://avatars.githubusercontent.com/u/5148853?v=4)](https://github.com/alksily "alksily (13 commits)")

---

Tags

phpframeworkvalidatorfilter

### Embed Badge

![Health badge](/badges/alksily-validator/health.svg)

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

PHPackages © 2026

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