Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Enum Laravel Package

spatie/laravel-enum

Laravel integration for spatie/enum: use Enum base class in Laravel, cast model attributes to enums (including nullable and arrays), and get Laravel-friendly behavior via custom casts and Castable support for Eloquent.

View on GitHub
Deep Wiki
Context7
3.1.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-enum/compare/3.0.3...3.1.0

3.0.2
  • Add Laravel 10 support
3.0.1
  • Fix nested form data casting - #86
3.0.0
  • Support Laravel 9
  • Enum request data transformation is only possible with $request->input() and not with $request->query->get() anymore:
- $request->query->get('status')
+ $request->input('status')






  • If you're working directly with the InputBag request object, you'll need to use all()[''] instead of get():
- $request->request->get('status');
+ $request->request->all()['status'];






2.5.2
  • fix :attribute replacement in \Spatie\Enum\Laravel\Rules\EnumRule::message() to respect custom attribute translations - #77
2.5.1
  • fix comma format with empty string value in database - #73
  • replaced deprecated make() call with from() - #74
2.5.0
  • add comma format to \Spatie\Enum\Laravel\Casts\EnumCollectionCast - #70
  • add \Spatie\Enum\Laravel\Enum::toRule() method - #66
2.4.0
  • add implicit and explicit route binding - #65
  • drop unusable Spatie\Enum\Laravel\Http\Middleware\TransformEnums middleware in favor of route binding

Warning: the dropped TransformEnums middleware was unusable - but if you've found a way to use it in your project this release will be breaking and you will have to switch to form requests or route binding.

2.3.0
  • accept enum instance in validation rule (Livewire) - #64
2.2.0
  • add customized enum stub logic - #58
2.1.0
2.0.1
  • fix \Spatie\Enum\Laravel\Rules\EnumRule with invalid types passed in - #54
2.0.0
  • upgrade spatie/enum to v3 - spatie/enum#56

  • drop PHP support for 7.2 and 7.3

  • drop Laravel support for 5.8 and 6.0 and 7.0

  • drop several custom exceptions:

    • ExpectsArrayOfEnumsField
    • InvalidEnumError
    • NoSuchEnumField
  • replace HasEnums trait by custom casts and default laravel query builder logic

  • add custom casts EnumCast and EnumCollectionCast

  • reduce make:enum command to --method option - no value/label mapping or method name formatting any more

  • add Laravel focused base Enum class which implements Jsonable, Castable

  • drop enum_index|EnumIndexRule, enum_name|EnumNameRule and enum_value|EnumValueRule validation rules

  • add Faker provider to generate random enum instances, values and labels \Spatie\Enum\Laravel\Faker\FakerEnumProvider

1.6.1
  • Support for Laravel 8
1.6.0
  • add array of enums cast #43
1.5.0
  • add classname to make command output #41
1.4.0
  • add request transformer #7

    • form request: Spatie\Enum\Laravel\Http\Requests\TransformsEnums
    • middleware: Spatie\Enum\Laravel\Http\Middleware\TransformEnums
    • macro: Illuminate\Http\Request::transformEnums()
1.3.0
  • add Laravel 7 support #34
1.2.0
  • add enum validation rules #13
1.1.0
  • add nullable model attribute enum castings #25 / #29
1.0.1
  • require symfony/console with PHP7.4 compatible version
1.0.0
  • initial release
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport