PHPackages                             kdudas/array-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. kdudas/array-validator

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

kdudas/array-validator
======================

Validate an array with a set of validators

1.4.2(3y ago)455gpl-3.0PHP

Since Aug 1Pushed 2y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (18)Used By (0)

array-validator
===============

[](#array-validator)

Validates an array of values with a set of validators

Example validator:
==================

[](#example-validator)

```
class DemoValidator extends ValidatorChain
{

    public function __construct()
    {
        $validators = [
            'phone' => [
                'required' => true,
                'validators' => [
                    [
                        'type' => Regexp::class,
                        //The message attribute changes the default message of the validator
                        'message' => 'Invalid phone number provided',
                        'options' => [
                            'pattern' => '/\+36-\d{2}[-]\d{3}[-]\d{4}\b/'
                        ]
                    ],
                    [
                        'type' => IsString::class
                    ]
                ]
            ],
            'name' => [
                'required' => true,
                //The Required message attribute changes the default message emmitted when a field is required, but is empty or not present
                'requiredMessage' => 'This field is required',
                'validators' => [
                    [
                        'type' => IsString::class
                    ]
                ]
            ],
            'status' => [
                'required' => true,
                'validators' => [
                    [
                        'type' => IsString::class
                    ],
                    [
                        'type' => Enum::class,
                        'options' => [
                            'allowedElements' => ['active', 'inactive', 'deleted']
                        ]
                    ]
                ]
            ]
        ];

        parent::__construct($validators);
    }

}
```

You can also create a new instance of the `KDudas\ArrayValidator\ValidatorChain` with the same parameters in its `__construct` as above and call its `isValid` method. If you want to add new validation logic, simply implement the `KDudas\ArrayValidator\ValidatorInterface` in a class and it is ready to use. To perform the validation, simply call the `isValid` method on the validator instance. To get validation messages, call the `getMessages` method on the `ValidatorChain` instance.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Every ~4 days

Total

9

Last Release

1355d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/622934807a0d8a5b8a6185b089e07eb3c613ed56857866acce7c5d719588271d?d=identicon)[dude920228](/maintainers/dude920228)

---

Top Contributors

[![dude920228](https://avatars.githubusercontent.com/u/8047367?v=4)](https://github.com/dude920228 "dude920228 (15 commits)")

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

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

7.6k894.0M1.2k](/packages/webmozart-assert)[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)
