PHPackages                             peltonsolutions/laravel-enums - 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. peltonsolutions/laravel-enums

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

peltonsolutions/laravel-enums
=============================

A custom package for Laravel for handling enum values on Models.

1.1.0(2y ago)21421MITPHPPHP ^8.2

Since Feb 5Pushed 2y agoCompare

[ Source](https://github.com/peltonsolutions/laravel-enums)[ Packagist](https://packagist.org/packages/peltonsolutions/laravel-enums)[ Docs](https://github.com/peltonsolutions/laravel-enums)[ RSS](/packages/peltonsolutions-laravel-enums/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (1)

laravel-enums
=============

[](#laravel-enums)

laravel-enums is a package by Pelton Solutions that allows Laravel developers to work easily with enumerated values. Enums (short for 'enumerations') represent a set of named constants in your code. By introducing enums, this package significantly enhances the readability and maintainability of your code.

In addition, you can optionally make your Enum fields nullable. To use this feature, simply have your Enum class extend the `NullableEnum` class.

Example:
--------

[](#example)

```
class ContentPageStatus extends \PeltonSolutions\LaravelEnums\Models\Enum
{
	const DRAFT = 'draft';
	const SCHEDULED = 'scheduled';
	const PUBLISHED = 'published';
	const ARCHIVED = 'archived';

	public static function map(): array
	{
		return [
			static::DRAFT => trans('content_page.statuses.draft'),
			static::SCHEDULED => trans('content_page.statuses.scheduled'),
			static::PUBLISHED => trans('content_page.statuses.published'),
			static::ARCHIVED => trans('content_page.statuses.archived'),
		];
	}
}
```

```
class ContentPage extends Model
{
	protected $casts = [
		'status' => ContentPageStatus::class
	];
}
```

These examples demonstrate how you could use enumerations in a Laravel model. `ContentPageStatus` is an enumeration that represents the possible status values that a `ContentPage` could have. The `ContentPage` model includes a casting to this enumeration, enabling more robust input validation and a more explicit declaration of the possible 'status' values. The package ensures value validation by throwing a `\PeltonSolutions\LaravelEnums\Models\Exceptions\InvalidEnumValueException` exception if you try to set a value that is not in the specified enumeration.

Install
-------

[](#install)

You can install the package via composer using the following command:

```
composer require peltonsolutions/laravel-enums
```

Testing
-------

[](#testing)

To ensure that laravel-enums is functioning correctly, you can run the package's tests using:

```
composer test
```

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Nathan Pelton](https://www.nathanpelton.com)

License
-------

[](#license)

laravel-enums is open-sourced software. It's licensed under the [MIT license](https://opensource.org/licenses/MIT), which is a permissive license allowing the software to be used, modified, and shared.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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

Total

3

Last Release

789d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ded85d0d1dc28dd8ed6029f3daabce49292c91c5a0482fe99a61261776fa275?d=identicon)[peltonsolutions](/maintainers/peltonsolutions)

---

Top Contributors

[![nathanpelton](https://avatars.githubusercontent.com/u/29257226?v=4)](https://github.com/nathanpelton "nathanpelton (21 commits)")

---

Tags

laravellaravel-enumspeltonsolutions

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/peltonsolutions-laravel-enums/health.svg)

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

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[whitecube/laravel-timezones

Store UTC dates in the database and work with custom timezones in the application.

106106.2k](/packages/whitecube-laravel-timezones)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)

PHPackages © 2026

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