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

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

ipl/validator
=============

Icinga PHP Library - Common validators and validator chaining

v1.0.0(1mo ago)075.8k↓40%1[1 PRs](https://github.com/Icinga/ipl-validator/pulls)1MITPHPPHP &gt;=8.2CI passing

Since Aug 2Pushed 1mo ago8 watchersCompare

[ Source](https://github.com/Icinga/ipl-validator)[ Packagist](https://packagist.org/packages/ipl/validator)[ Docs](https://github.com/Icinga/ipl-validator)[ RSS](/packages/ipl-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (9)Versions (14)Used By (1)

Icinga PHP Library - Common Validators and Validator Chaining
=============================================================

[](#icinga-php-library---common-validators-and-validator-chaining)

`ipl/validator` provides a collection of reusable input validators and a `ValidatorChain` to compose and execute multiple validators in a user-defined order.

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

[](#installation)

The recommended way to install this library is via [Composer](https://getcomposer.org):

```
composer require ipl/validator
```

`ipl/validator` requires PHP 8.0 or later with the `mbstring` and `openssl` extensions.

Usage
-----

[](#usage)

### Applying a Single Validator

[](#applying-a-single-validator)

Every validator exposes the same basic workflow:

1. Configure the validator
2. Call `isValid($value)`
3. Read validation errors via `getMessages()` if validation fails

```
use ipl\Validator\StringLengthValidator;

$validator = new StringLengthValidator([
    'min' => 3,
    'max' => 10,
]);

// $value is the input to validate.
if (! $validator->isValid($value)) {
    echo implode(PHP_EOL, $validator->getMessages());
}
```

### Composing Multiple Validators with `ValidatorChain`

[](#composing-multiple-validators-with-validatorchain)

Use `ValidatorChain` when a value must satisfy multiple conditions. By default, all validators run in sequence even when one fails, so every error is collected. Set `breakChainOnFailure: true` when adding a validator to stop on the first failure.

```
use ipl\Validator\HostnameValidator;
use ipl\Validator\RegexMatchValidator;
use ipl\Validator\ValidatorChain;

$chain = new ValidatorChain();
$chain->add(new HostnameValidator(), breakChainOnFailure: true);
$chain->add(new RegexMatchValidator('/^api\./'));

// $value is the input to validate.
if (! $chain->isValid($value)) {
    echo implode(PHP_EOL, $chain->getMessages());
}
```

In this example, the chain stops early when `HostnameValidator` fails because it was added with `breakChainOnFailure: true`.

Built-In Validators
-------------------

[](#built-in-validators)

`ipl/validator` ships with validators for common categories of input:

- **Value and range** — string length, numeric comparisons, and membership tests
- **Text and network formats** — email addresses, hostnames, CIDR notation, dates, and regular expressions
- **File and security** — uploaded files, private keys, and X.509 certificates
- **Custom logic** — callback-based validation for specific rules:

    ```
    use ipl\Validator\CallbackValidator;

    // Illustrates cross-field validation, omits type checks for brevity.
    $validator = new CallbackValidator(function ($end, CallbackValidator $validator) use ($start): bool {
        if ($end addMessage('End must be after start.');

            return false;
        }

        return true;
    });
    ```

    Use this for rules that built-in validators cannot express — such as cross-field comparisons or checks against runtime state.

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for a list of notable changes.

License
-------

[](#license)

`ipl/validator` is licensed under the terms of the [MIT License](LICENSE.md).

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~367 days

Recently: every ~407 days

Total

7

Last Release

55d ago

Major Versions

v0.5.0 → v1.0.0.x-dev2026-03-24

PHP version history (3 changes)v0.1.0PHP &gt;=5.6.0

v0.4.0PHP &gt;=7.2

v1.0.0.x-devPHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/39625a91c802211110651e31881abdd47b715dad6a8879493d55933eb24a46c0?d=identicon)[ipl](/maintainers/ipl)

---

Top Contributors

[![sukhwinder33445](https://avatars.githubusercontent.com/u/54990055?v=4)](https://github.com/sukhwinder33445 "sukhwinder33445 (41 commits)")[![lippserd](https://avatars.githubusercontent.com/u/1894563?v=4)](https://github.com/lippserd "lippserd (40 commits)")[![nilmerg](https://avatars.githubusercontent.com/u/16668527?v=4)](https://github.com/nilmerg "nilmerg (35 commits)")[![Al2Klimov](https://avatars.githubusercontent.com/u/6053266?v=4)](https://github.com/Al2Klimov "Al2Klimov (8 commits)")[![yhabteab](https://avatars.githubusercontent.com/u/57616252?v=4)](https://github.com/yhabteab "yhabteab (4 commits)")[![raviks789](https://avatars.githubusercontent.com/u/33730024?v=4)](https://github.com/raviks789 "raviks789 (1 commits)")[![jrauh01](https://avatars.githubusercontent.com/u/81301701?v=4)](https://github.com/jrauh01 "jrauh01 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[aporat/store-receipt-validator

PHP receipt validator for Apple App Store and Amazon Appstore

6503.9M9](/packages/aporat-store-receipt-validator)[laminas/laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria

15644.9M188](/packages/laminas-laminas-validator)

PHPackages © 2026

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