PHPackages                             lazerg/laravel-enum-pro - 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. lazerg/laravel-enum-pro

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

lazerg/laravel-enum-pro
=======================

A powerful PHP enum extension with collection support, random selection, and magic static calls

v0.7.0(3mo ago)4319.0k↑100%2[1 issues](https://github.com/lazerg/laravel-enum-pro/issues)MITPHPPHP ^8.1CI passing

Since Mar 1Pushed 3mo ago2 watchersCompare

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

READMEChangelogDependencies (2)Versions (18)Used By (0)

Laravel Enum Pro
================

[](#laravel-enum-pro)

[![Laravel Enum Pro](./wallpaper/wallpaper.png)](./wallpaper/wallpaper.png)

[![Latest Version](https://camo.githubusercontent.com/776e9842f9f04cd628a3261ee6eb8c4f51d60042f3815ade31b91b8aa014bc44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c617a6572672f6c61726176656c2d656e756d2d70726f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lazerg/laravel-enum-pro)[![PHP Version](https://camo.githubusercontent.com/73c839184503deb885f3a0c5f246da5c13ab4727039e668c63aa71e09afad4b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c617a6572672f6c61726176656c2d656e756d2d70726f3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lazerg/laravel-enum-pro)[![Downloads](https://camo.githubusercontent.com/217fb453c9d276a59b9564b9da240d202915fec5eb33d416598fa19b7272f01f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c617a6572672f6c61726176656c2d656e756d2d70726f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lazerg/laravel-enum-pro)[![Total Downloads](https://camo.githubusercontent.com/a311111da36653f6c7225742be1c852cdded9bf3a3e6217fa46c6e39bdacee51/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c617a6572672f6c61726176656c2d656e756d2d70726f3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lazerg/laravel-enum-pro)[![Packagist Stars](https://camo.githubusercontent.com/ecc6289a80bb9910a344c282765d92647eb39aac7b2f1a79a41193776eec75b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6c617a6572672f6c61726176656c2d656e756d2d70726f3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lazerg/laravel-enum-pro)

A powerful trait that supercharges PHP 8.1+ enums with Laravel-friendly utilities. Get values, names, random cases, and form-ready options with a clean, fluent API.

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

[](#installation)

```
composer require lazerg/laravel-enum-pro
```

Enum Example
------------

[](#enum-example)

```
enum DifficultyEnum: int
{
    use \Lazerg\LaravelEnumPro\EnumPro;

    case VERY_EASY = 1;
    case EASY = 2;
    case MEDIUM = 3;
    case STRONG = 4;
    case VERY_STRONG = 5;
}
```

Accessing Value
---------------

[](#accessing-value)

```
// 1
DifficultyEnum::VERY_EASY();

// 3
DifficultyEnum::MEDIUM();

// 5
DifficultyEnum::VERY_STRONG();

// 3
$enum = DifficultyEnum::MEDIUM;
$enum();
```

Accessing Name
--------------

[](#accessing-name)

```
// ['VERY_EASY', 'EASY', 'MEDIUM', 'STRONG', 'VERY_STRONG']
DifficultyEnum::namesToArray();

// 'VERY_EASY, EASY, MEDIUM, STRONG, VERY_STRONG'
DifficultyEnum::namesToString();

// Collection(['VERY_EASY', 'EASY', 'MEDIUM', 'STRONG', 'VERY_STRONG'])
DifficultyEnum::names();

// 'MEDIUM'
DifficultyEnum::nameOf(3);
```

Accessing Values
----------------

[](#accessing-values)

```
// [1, 2, 3, 4, 5]
DifficultyEnum::valuesToArray();

// '1,2,3,4,5'
DifficultyEnum::valuesToString();

// Collection([1, 2, 3, 4, 5])
DifficultyEnum::values();

// 1
DifficultyEnum::valueOf('VERY_EASY');

// 3 (case-insensitive)
DifficultyEnum::valueOf('medium');

// 5 (spaces converted to underscores)
DifficultyEnum::valueOf('Very strong');
```

Accessing Options
-----------------

[](#accessing-options)

```
// [1 => 'Very Easy', 2 => 'Easy', 3 => 'Medium', 4 => 'Strong', 5 => 'Very Strong']
DifficultyEnum::optionsToArray();

// Collection([1 => 'Very Easy', 2 => 'Easy', 3 => 'Medium', 4 => 'Strong', 5 => 'Very Strong'])
DifficultyEnum::options();

// 'Very Strong'
DifficultyEnum::getOption(5);

// ['Medium', 'Very Strong']
DifficultyEnum::getOptions([3, 5]);

// [['value' => 1, 'display' => 'Very Easy'], ['value' => 2, 'display' => 'Easy'], ...]
DifficultyEnum::selectionsToArray();

// Collection([['value' => 1, 'display' => 'Very Easy'], ['value' => 2, 'display' => 'Easy'], ...])
DifficultyEnum::selections();
```

Accessing Random Value
----------------------

[](#accessing-random-value)

```
// [3, 1] (random values)
DifficultyEnum::randomArray(2);

// 4 (single random value)
DifficultyEnum::randomFirst();

// Collection([2, 5, 1]) (random values)
DifficultyEnum::random(3);
```

Testing
-------

[](#testing)

```
./vendor/bin/pest
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance79

Regular maintenance activity

Popularity37

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76% 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 ~95 days

Recently: every ~269 days

Total

16

Last Release

110d ago

PHP version history (3 changes)v0.1.0PHP ^8.1

v0.5.2PHP ^8.1|^8.2|^8.3

v0.6.0PHP ^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/47a0e1fd676ee37f87a606b2836a322991bf5decac456ec403687e4374519491?d=identicon)[lazerg](/maintainers/lazerg)

---

Top Contributors

[![lazerg](https://avatars.githubusercontent.com/u/20501725?v=4)](https://github.com/lazerg "lazerg (19 commits)")[![itsmirik](https://avatars.githubusercontent.com/u/73518261?v=4)](https://github.com/itsmirik "itsmirik (4 commits)")[![Adizbek](https://avatars.githubusercontent.com/u/10253982?v=4)](https://github.com/Adizbek "Adizbek (2 commits)")

---

Tags

enumlaravelphpphplaravelhelperenumcollection

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/lazerg-laravel-enum-pro/health.svg)

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

###  Alternatives

[monicahq/laravel-cloudflare

Add Cloudflare ip addresses to trusted proxies for Laravel.

3372.7M4](/packages/monicahq-laravel-cloudflare)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[kra8/laravel-snowflake

Snowflake for Laravel and Lumen.

188402.3k6](/packages/kra8-laravel-snowflake)[mindtwo/native-enum

Package for using native php enums.

2626.0k1](/packages/mindtwo-native-enum)[werxe/laravel-collection-macros

Custom Laravel Collection macros.

2625.8k](/packages/werxe-laravel-collection-macros)

PHPackages © 2026

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