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

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

kasperh90/symfony-extra-constraints
===================================

A collection of additional validation constraints for the Symfony Validator component

v1.1.0(2mo ago)0104↓91.7%MITPHPPHP &gt;=8.2

Since Mar 11Pushed 2mo agoCompare

[ Source](https://github.com/kasperh90/symfony-extra-constraints)[ Packagist](https://packagist.org/packages/kasperh90/symfony-extra-constraints)[ Docs](https://github.com/kasperh90/symfony-extra-constraints)[ RSS](/packages/kasperh90-symfony-extra-constraints/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Symfony Extra Constraints
=========================

[](#symfony-extra-constraints)

A collection of additional validation constraints for the [Symfony Validator](https://github.com/symfony/validator) component.

[![PHP Version](https://camo.githubusercontent.com/4f0ff8d47b7c73441eb92a1f49af61c2d6521b14113c8fd85fac4416c863e7cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d626c7565)](https://camo.githubusercontent.com/4f0ff8d47b7c73441eb92a1f49af61c2d6521b14113c8fd85fac4416c863e7cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d626c7565)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)

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

[](#installation)

```
composer require kasperh90/symfony-extra-constraints
```

Usage
-----

[](#usage)

Import the constraints:

```
use Kasperh90\SymfonyExtraConstraints\Validator\Constraints as ExtraAssert;
```

### Sum

[](#sum)

Validates that the sum of a collection of numeric values meets a given constraint.

```
class Allocation
{
    #[ExtraAssert\Sum(exactly: 100)]
    public array $percentages;

    #[ExtraAssert\Sum(min: 10)]
    public array $scores;

    #[ExtraAssert\Sum(max: 500)]
    public array $expenses;
}
```

#### Options

[](#options)

- `exactly`: Require the sum to equal a specific value
- `min`: Require the sum to be greater than or equal to a value
- `max`: Require the sum to be less than or equal to a value

### Average

[](#average)

Validates that the average of a collection of numeric values meets a given constraint.

```
class Ratings
{
    #[ExtraAssert\Average(min: 3.5)]
    public array $userRatings;

    #[ExtraAssert\Average(max: 5)]
    public array $scores;

    #[ExtraAssert\Average(exactly: 4)]
    public array $normalizedRatings;
}
```

#### Options

[](#options-1)

- `exactly`: Require the average to equal a specific value
- `min`: Require the average to be greater than or equal to a value
- `max`: Require the average to be less than or equal to a value

License
-------

[](#license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Total

2

Last Release

89d ago

### Community

Maintainers

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

---

Top Contributors

[![kasperh90](https://avatars.githubusercontent.com/u/36596298?v=4)](https://github.com/kasperh90 "kasperh90 (6 commits)")

---

Tags

symfonyvalidatorvalidationconstraintssymfony-validator

### Embed Badge

![Health badge](/badges/kasperh90-symfony-extra-constraints/health.svg)

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

###  Alternatives

[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.4M](/packages/barbieswimcrew-zip-code-validator)[rollerworks/password-strength-validator

Password-strength validator for Symfony

1445.9M7](/packages/rollerworks-password-strength-validator)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1155.2k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

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