PHPackages                             open-core/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. open-core/validator

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

open-core/validator
===================

Simple, fast and lightweight validator based on attributes and internal DSL

072PHP

Since Apr 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/idashevskii/open-core-validator)[ Packagist](https://packagist.org/packages/open-core/validator)[ RSS](/packages/open-core-validator/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

OpenCore Validator
------------------

[](#opencore-validator)

*Simple, fast and lightweight validator based on attributes and internal DSL*

Key features:

- Hi-level API using PHP Attributes and low-level API using internal DSL
- Support for nesting typed structures
- Support for nested and typed arrays
- Deserialization

### Example

[](#example)

Having some complex models:

```
class LoginApplicationForm {

  #[LenBetween(3, 16)]
  public string $login;

  #[LenBetween(8, 16)]
  public string $password;
}

class GuestApplicationForm {

  public LoginApplicationForm $userLogin;

  public bool $acceptTerms = false;

  #[Email]
  #[LenBetween(5, 24)]
  public ?string $email;

  #[CountBetween(1, 5)]
  #[Each([new LenBetween(3, 16)])]
  #[Arr(Type::STRING)]
  public array $interests = [];

  #[Key('q1', [new Optional([new LenBetween(0, 16)])])]
  #[Key('q2', [new LenBetween(1, 32)])]
  #[Key('q3', [new Between(0, 100)])]
  #[Arr(Type::MIXED)]
  public array $survey;
}
```

And user input:

```
$userInput=[
  'userLogin' => [
    'login' => 'mylogin',
    'password' => '$mypass657$',
  ],
  'acceptTerms' => true,
  'email' => 'user@example.com',
  'phone' => '+000 000-000-000',
  'interests' => ['music', 'movie'],
  'survey' => ['q1' => 'yes', 'q2' => 'I dont know', 'q3' => 42],
];
```

Validate data according to model:

```
try{
  Validator::validateByModel(GuestApplicationForm::class, $userInput);
}catch(ValidationException $ex){
  print_r($ex->result->inspect());
}
```

Or even deserialize data to object after validation:

```
try{
  $form = Validator::deserialize(GuestApplicationForm::class, $userInput);
}catch(ValidationException $ex){
  print_r($ex->result->inspect());
}
```

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d83615d99e4e14a999e5372e4a352954ff4843f6ee071f741ce53bb7c845daae?d=identicon)[idashevskii](/maintainers/idashevskii)

---

Top Contributors

[![idashevskii](https://avatars.githubusercontent.com/u/2737339?v=4)](https://github.com/idashevskii "idashevskii (9 commits)")

---

Tags

phpvalidation

### Embed Badge

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

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

PHPackages © 2026

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