orkhanahmadov/eloquent-enum-cast
Eloquent Enum Cast lets Laravel Eloquent models cast attributes to native PHP 8 enums. Declare an enum in your model's casts array and read database values as typed enum instances, keeping code type-safe and readable without manual conversion logic.
eloquent-enum-cast brings clean PHP enum support to Eloquent models, letting you store a backed enum value in the database while working with a type-safe enum instance in your code. Instead of manually mapping strings or integers in accessors and mutators, you define a cast and let the package handle conversion in both directions.
$casts definitionsHow can I help you explore Laravel packages today?