PHPackages                             dealnews/constraints - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dealnews/constraints

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dealnews/constraints
====================

Type constraint checking library

v3.0.0(9mo ago)114.0k↓61.2%12BSD-3-ClausePHPPHP ^8.2CI passing

Since Mar 10Pushed 2mo ago7 watchersCompare

[ Source](https://github.com/dealnews/constraints)[ Packagist](https://packagist.org/packages/dealnews/constraints)[ RSS](/packages/dealnews-constraints/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (6)Dependencies (3)Versions (10)Used By (2)

Constraints
===========

[](#constraints)

A library for testing primitive and abstract data types in PHP with type juggling.

Supported Primitive Types
-------------------------

[](#supported-primitive-types)

- Integer
- String
- Array
- Double (aka float)
- Boolean
- Any defined PHP class

Supported Abstract Types
------------------------

[](#supported-abstract-types)

- Bytes
- US Currency
- Date
- DateTime
- Length
- Range
- Time
- URL
- URL Path
- Year

Extendable
----------

[](#extendable)

The base `Constraint` class can be extended to add new abstract types.

Example
-------

[](#example)

```
// A very simple example
$constraint = \DealNews\Constraints\Constraint::init();
$value = "1";
try {
    $value = $constraint->check($value, ["type" => "integer"]);
    // $value will now be integer 1
} catch (\DealNews\Constraints\ConstraintException $e) {
    echo $e->getMessage();
}
```

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance73

Regular maintenance activity

Popularity28

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 81% 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 ~475 days

Recently: every ~515 days

Total

6

Last Release

297d ago

Major Versions

v1.0.0 → 2.0.02020-01-17

v2.2.1 → v3.0.02025-09-09

PHP version history (3 changes)v1.0.0PHP &gt;=7.1.0

v2.2.0PHP ^8.0

v3.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49531?v=4)[Brian Moon](/maintainers/brianlmoon)[@brianlmoon](https://github.com/brianlmoon)

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

---

Top Contributors

[![brianlmoon](https://avatars.githubusercontent.com/u/49531?v=4)](https://github.com/brianlmoon "brianlmoon (17 commits)")[![jearle-dealnews](https://avatars.githubusercontent.com/u/8784094?v=4)](https://github.com/jearle-dealnews "jearle-dealnews (4 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/dealnews-constraints/health.svg)

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

###  Alternatives

[yaza/laravel-repository-service

Simple repository, service pattern for laravel

14441.2k2](/packages/yaza-laravel-repository-service)[weiaibaicai/ueditor

Dcat Admin Extension 百度编辑器

114.0k](/packages/weiaibaicai-ueditor)

PHPackages © 2026

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