PHPackages                             mindtwo/laravel-enumerable - 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. mindtwo/laravel-enumerable

Abandoned → [bensampo/laravel-enum](/?search=bensampo%2Flaravel-enum)ArchivedPackage[Utility &amp; Helpers](/categories/utility)

mindtwo/laravel-enumerable
==========================

Laravel Enumerable

3.1.0(6y ago)032MITPHPPHP ^7.2

Since Dec 4Pushed 6y ago2 watchersCompare

[ Source](https://github.com/mindtwo/laravel-enumerable)[ Packagist](https://packagist.org/packages/mindtwo/laravel-enumerable)[ RSS](/packages/mindtwo-laravel-enumerable/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (6)Versions (13)Used By (0)

Laravel Enumerable Eloquent Models
==================================

[](#laravel-enumerable-eloquent-models)

[![Build Status](https://camo.githubusercontent.com/6e7d6ad9749b5f3ec2390135c6919c24d3767cf9a86ab6df0e995b802c358d50/68747470733a2f2f7472617669732d63692e6f72672f6d696e6474776f2f6c61726176656c2d656e756d657261626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mindtwo/laravel-enumerable)[![StyleCI](https://camo.githubusercontent.com/ecd7c7551180d722a745dfdf2eb7e12dfca4a76365b0cf518d22a42d423a64ea/68747470733a2f2f7374796c6563692e696f2f7265706f732f3136303332383533352f736869656c64)](https://styleci.io/repos/160328535)[![Quality Score](https://camo.githubusercontent.com/53e97421f0bad01ab0c74e83151d44d49e70713d0a92a29c75c72bb0a69eacbf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d696e6474776f2f6c61726176656c2d656e756d657261626c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mindtwo/laravel-enumerable)[![Latest Stable Version](https://camo.githubusercontent.com/682aa0471d7aee68969fd0fe3f0d23535e9eeae6f5d5dc16321cc032e7a28ad8/68747470733a2f2f706f7365722e707567782e6f72672f6d696e6474776f2f6c61726176656c2d656e756d657261626c652f762f737461626c65)](https://packagist.org/packages/mindtwo/laravel-enumerable)[![Total Downloads](https://camo.githubusercontent.com/b33b0d843d463838011e33b078208718c5a537dd59166dfefb74df461548e497/68747470733a2f2f706f7365722e707567782e6f72672f6d696e6474776f2f6c61726176656c2d656e756d657261626c652f646f776e6c6f616473)](https://packagist.org/packages/mindtwo/laravel-enumerable)[![License](https://camo.githubusercontent.com/f7dade86d724cc75cd61cd4104b3936105759756789d296cccece8c61a930b94/68747470733a2f2f706f7365722e707567782e6f72672f6d696e6474776f2f6c61726176656c2d656e756d657261626c652f6c6963656e7365)](https://packagist.org/packages/mindtwo/laravel-enumerable)

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

[](#installation)

You can install the package via composer:

```
composer require mindtwo/laravel-enumerable
```

How to use?
-----------

[](#how-to-use)

### Setting up enumerable objects

[](#setting-up-enumerable-objects)

This package based on [BenSampo/laravel-enum](https://github.com/BenSampo/laravel-enum). Take a look at its [Documentation](https://sampo.co.uk/blog/using-enums-in-laravel) to set up your enumerable objects.

### Prepare eloquent model

[](#prepare-eloquent-model)

There are two ways to use this package. The simplest way is to extend the EnumerableModel which is shipped with this package.

```
namespace example;

use mindtwo\LaravelEnumerable\Models\EnumerableModel

class exampleModel extends EnumerableModel
{
}
```

If you prefer, you can directly use the Enumerable trait in your models. Be sure to implement the EnumerableInterface, too.

```
namespace example;

use Illuminate\Database\Eloquent\Model;
use mindtwo\LaravelEnumerable\Interfaces\EnumInterface;
use mindtwo\LaravelEnumerable\Models\Traits\Enumerable;

class exampleModel extends Model implements EnumInterface
{
    use Enumerable;
}
```

### Configure eloquent model

[](#configure-eloquent-model)

To configure enumerable attributes simply set up a property named 'enums' as array. The key contains the attribute name. The value is set to the enumerable class name you like to use for that attribute.

```
namespace example;

use mindtwo\LaravelEnumerable\Models\EnumerableModel

class exampleModel extends EnumerableModel
{
    public $enums = [
        'examle_attribute' => ExampleEnum::class
    ];
}
```

> Important: Since package version 1.1.0 the $enums property must be declared as public!

Now you can use Laravel's regular attribute set and fill functions to set the attribute value. If the value is not configured in the given enum object, an InvalidEnumValueException is thrown.

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [mindtwo GmbH](https://github.com/mindtwo)
- [All Other Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

11

Last Release

2289d ago

Major Versions

1.1.0 → 2.02019-03-07

2.0.3 → 3.0.02019-08-28

PHP version history (2 changes)1.0PHP ^7.1.3

3.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cc86fe6179314d204b14d1c81eb09a87ef84b0bcf2360dcd981171d1346c077?d=identicon)[mindtwo](/maintainers/mindtwo)

---

Top Contributors

[![tkivelip](https://avatars.githubusercontent.com/u/3762670?v=4)](https://github.com/tkivelip "tkivelip (12 commits)")[![jonasemde](https://avatars.githubusercontent.com/u/5083193?v=4)](https://github.com/jonasemde "jonasemde (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mindtwo-laravel-enumerable/health.svg)

```
[![Health](https://phpackages.com/badges/mindtwo-laravel-enumerable/health.svg)](https://phpackages.com/packages/mindtwo-laravel-enumerable)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[wearepixel/laravel-cart

A cart implementation for Laravel

1355.6k](/packages/wearepixel-laravel-cart)

PHPackages © 2026

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