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

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

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

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

1.1.0(2y ago)1163[4 PRs](https://github.com/peltonsolutions/laravel-enums/pulls)1MITPHPPHP ^8.2CI passing

Since Feb 5Pushed 2w 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 2d ago

READMEChangelog (2)Dependencies (3)Versions (8)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

39

—

LowBetter than 84% of packages

Maintenance63

Regular maintenance activity

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

843d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/41953789?v=4)[Pelton Solutions, LLC](/maintainers/peltonsolutions)[@peltonsolutions](https://github.com/peltonsolutions)

---

Top Contributors

[![nathanpelton](https://avatars.githubusercontent.com/u/29257226?v=4)](https://github.com/nathanpelton "nathanpelton (25 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

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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