# BenSampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

Repository: https://github.com/BenSampo/laravel-enum
Canonical: https://ross.abutalabs.com/products/laravel-enum
Homepage: https://sampo.co.uk/blog/using-enums-in-laravel
Language: PHP
License: MIT
License Family: permissive
Topics: enum, laravel-enum, enumeration, laravel, enum-instantiation, bitwise-enum, enum-library, laravel-package, php
Last push: 2026-03-29T17:01:48+00:00

## Health v2 (maintenance only)
Score: 66/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 74, release rhythm 35, longevity 100
- inputs: {"age_days": 3282, "days_push": 157, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2030, forks 157 (observed 2026-08-28T04:06:07.186039+00:00)

## What it is
A Laravel package providing a simple, extensible enumeration implementation with class constants, instantiation, flagged/bitwise enums, attribute casting, validation rules, and artisan generators. The README now recommends against using it for new projects since PHP 8.1 supports enums natively.

## Use cases
- add enums to a Laravel app on PHP below 8.1
- validate request input against enum keys or values
- cast Eloquent model attributes to enum instances
- create flagged bitwise enum flags
- generate enum classes with an artisan command
- attach localized descriptions to enum values

## When to choose
- you're on a legacy Laravel/PHP codebase predating PHP 8.1 native enums
- you need bitwise/flagged enums with helper methods
- you want enum-aware validation and attribute casting in Laravel

## When to avoid
- starting a new project on PHP 8.1 or later — use native PHP enums
- you need a long-term maintained solution — the library is no longer recommended

## Facets
- artifact type: library
- maturity: maintenance
- function: developer-tools, cli, form-handling
- domain: web-development, developer-tools, programming-languages
- platform: php
- tags: enum, laravel-package, bitwise-enum, attribute-casting, php-enums, deprecated-in-favor-of-native-enums, laravel

## Member repositories
- BenSampo/laravel-enum (main) score 66

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:07.186039+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:59:33.731862+00:00, confidence not recorded.
  - readme: https://github.com/BenSampo/laravel-enum (fetched 2026-08-28T04:06:07.186039+00:00, sha 667fe1ec58ae)
  - homepage: https://sampo.co.uk/blog/using-enums-in-laravel (fetched 2026-08-29T10:39:21.401511+00:00, sha 424fb9246bc1)
- Data as of 2026-08-30T08:39:29.467469+00:00.
