PHPackages                             rvxlab/laravel-enum-cast - 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. rvxlab/laravel-enum-cast

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

rvxlab/laravel-enum-cast
========================

Enum casts for Laravel

1.1.1(4y ago)11.1kMITPHPPHP ^7.3|^8.0

Since Mar 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/RVxLab/laravel-enum-cast)[ Packagist](https://packagist.org/packages/rvxlab/laravel-enum-cast)[ RSS](/packages/rvxlab-laravel-enum-cast/feed)WikiDiscussions main Synced today

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

[![Laravel Enum Cast Banner, made with https://banners.beyondco.de](banner.png "Laravel Enum Cast")](banner.png)

Laravel Enum Cast
=================

[](#laravel-enum-cast)

This package is no longer maintained
------------------------------------

[](#this-package-is-no-longer-maintained)

**Native enums are supported as of PHP 8.1 and Laravel 8.71.0, as such I will no longer be maintaining this package.**

Enum cast for Laravel Models using [myclabs/php-enum](https://github.com/myclabs/php-enum).

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

[](#installation)

Install through composer

```
composer require rvxlab/laravel-enum-cast
```

Usage
-----

[](#usage)

Add the `CastsEnums` trait to your model, add the `EnumCast` class to the `$casts` array and create an `$enums` array to tell which enum should be used.

```
class CarMake extends \MyCLabs\Enum\Enum
{
    public const VOLKSWAGEN = 'volkswagen';
    public const BMW = 'bmw';
}

class Car extends \Illuminate\Database\Eloquent\Model
{
    use \RVxLab\LaravelEnumCast\CastsEnums;

    protected $casts = [
        'make' => \RVxLab\LaravelEnumCast\EnumCast::class,
    ];

    protected $enums = [
        'make' => CarMake::class,
    ];
}
```

That's it, you're all set!

License
-------

[](#license)

This project uses the MIT License

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

1546d ago

### Community

Maintainers

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

---

Top Contributors

[![RVxLab](https://avatars.githubusercontent.com/u/46111684?v=4)](https://github.com/RVxLab "RVxLab (11 commits)")

---

Tags

laravelpackageenumsmyclabs

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/rvxlab-laravel-enum-cast/health.svg)

```
[![Health](https://phpackages.com/badges/rvxlab-laravel-enum-cast/health.svg)](https://phpackages.com/packages/rvxlab-laravel-enum-cast)
```

###  Alternatives

[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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