PHPackages                             hmayer/enum-field - 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. hmayer/enum-field

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

hmayer/enum-field
=================

A Laravel Nova field for PHP Enum classes.

v1.0.1(3y ago)08MITPHPPHP &gt;=8.1.0

Since Mar 29Pushed 3y agoCompare

[ Source](https://github.com/hmayer/enum-field)[ Packagist](https://packagist.org/packages/hmayer/enum-field)[ RSS](/packages/hmayer-enum-field/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Nova Enum Field
=======================

[](#laravel-nova-enum-field)

Nova field for enum in PHP 8.1 and above.

I try to keep the same `suleymanozev/enum-field` interface, but with some additions to my personal needs.

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

[](#installation)

You can install this package in a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require hmayer/enum-field
```

Setup
-----

[](#setup)

```
use App\Enums\UserType;
use Illuminate\Database\Eloquent\Model;

class Example extends Model
{
    protected $casts = [
        'user_type' => UserType::class,
    ];
}
```

Usage
-----

[](#usage)

You can use the `Enum` field in your Nova resource like this:

```
namespace App\Nova;

use App\Enums\UserType;
use Hmayer\EnumField\Enum;

class Example extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            Enum::make('User Type')->attach(UserType::class),

            // ...
        ];
    }
}
```

### Filters

[](#filters)

If you would like to use the provided Nova Select filter (which is compatible with both the `Enum` and `FlaggedEnum` fields), you can include it like this:

```
namespace App\Nova;

use App\Enums\UserPermissions;
use App\Enums\UserType;
use Hmayer\EnumField\EnumFilter;

class Example extends Resource
{
    // ...

    public function filters(Request $request)
    {
        return [
            EnumFilter::make(__('User Type'), 'user_type', UserType::class),

             // With optional default value:
            EnumFilter::make(__('User Type'), 'user_type', UserType::class, UserType::Administrator),
        ];
    }
}
```

Alternatively, you may wish to use the provided Nova Boolean filter (which is also compatible with both the `Enum` and `FlaggedEnum` fields):

```
namespace App\Nova;

use App\Enums\UserPermissions;
use App\Enums\UserType;
use Hmayer\EnumField\EnumBooleanFilter;

class Example extends Resource
{
    // ...

    public function filters(Request $request)
    {
        return [
            EnumBooleanFilter::make(__('User Type'), 'user_type', UserType::class),

            // With optional default values:
            EnumBooleanFilter::make(__('User Type'), 'user_type', UserType::class, [
                UserType::Administrator,
                UserType::Moderator,
            ]),
        ];
    }
}
```

Credits
-------

[](#credits)

- [Henrique Mayer](https://github.com/hmayer)

Thanks
------

[](#thanks)

- [Süleyman ÖZEV](https://github.com/suleymanozev)
- [simplesquid/nova-enum-field](https://github.com/simplesquid/nova-enum-field)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~37 days

Total

2

Last Release

1109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43e9d86f8c749a94806258fa945ce9bb1e1a958d17508d73dae0a48eccf8b7bb?d=identicon)[hmayer](/maintainers/hmayer)

---

Top Contributors

[![suleymanozev](https://avatars.githubusercontent.com/u/20399264?v=4)](https://github.com/suleymanozev "suleymanozev (3 commits)")[![bohemima](https://avatars.githubusercontent.com/u/195410?v=4)](https://github.com/bohemima "bohemima (1 commits)")[![hmayer](https://avatars.githubusercontent.com/u/20026?v=4)](https://github.com/hmayer "hmayer (1 commits)")

---

Tags

laravelenumnova

### Embed Badge

![Health badge](/badges/hmayer-enum-field/health.svg)

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

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[simplesquid/nova-enum-field

A Laravel Nova field to add enums to resources.

52391.9k2](/packages/simplesquid-nova-enum-field)[datomatic/nova-enum-field

A Laravel Nova PHP 8.1 enum field with filters

20134.2k](/packages/datomatic-nova-enum-field)[digital-creative/conditional-container

Provides an easy way to conditionally show and hide fields in your Nova resources.

116593.8k4](/packages/digital-creative-conditional-container)

PHPackages © 2026

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