PHPackages                             muffe/enum-constraint - 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. muffe/enum-constraint

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

muffe/enum-constraint
=====================

A Symfony Validator constraint that validates if given strings are valid cases in a given PHP 8 Enum

v0.2.1(1y ago)213.2k↑500%1MITPHPPHP &gt;=8.1

Since Aug 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/muffe/enum-constraint)[ Packagist](https://packagist.org/packages/muffe/enum-constraint)[ RSS](/packages/muffe-enum-constraint/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

enum-constraint
===============

[](#enum-constraint)

A Symfony Validator constraint that validates if given strings are valid cases in a given PHP 8 Enum

```
enum ContactCategory: string
{
    case Child           = 'Child';
    case Grandchild      = 'Grandchild';
}

use Muffe\EnumConstraint\Constraints\Enum;

#[
    Enum(
        enumType: ContactCategory::class,
    )
]
public ?string $category = null;

```

Validates that $category contains a string that is equal to the backed value of one of the given enum cases, or the name of the case if no backed values are given.

```
use Muffe\EnumConstraint\Constraints\Enum;

#[
    Enum(
        enumType: ContactCategory::class,
        multiple: true
    )
]
public ?array $categories = null;

```

Also supports validating multiple given values

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance42

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~320 days

Total

4

Last Release

466d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/366059?v=4)[Marc Wustrack](/maintainers/muffe)[@muffe](https://github.com/muffe)

---

Top Contributors

[![muffe](https://avatars.githubusercontent.com/u/366059?v=4)](https://github.com/muffe "muffe (6 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (1 commits)")

---

Tags

validatorenumconstraint

### Embed Badge

![Health badge](/badges/muffe-enum-constraint/health.svg)

```
[![Health](https://phpackages.com/badges/muffe-enum-constraint/health.svg)](https://phpackages.com/packages/muffe-enum-constraint)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M387](/packages/easycorp-easyadmin-bundle)[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.5M](/packages/barbieswimcrew-zip-code-validator)[api-platform/validator

API Platform validator component

274.6M27](/packages/api-platform-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.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[rollerworks/password-strength-validator

Password-strength validator for Symfony

1446.0M7](/packages/rollerworks-password-strength-validator)[api-platform/serializer

API Platform core Serializer

274.8M84](/packages/api-platform-serializer)

PHPackages © 2026

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