All notable changes to laravel-enum-helper
will be documented in this file.
- fixed error of annotation command with folder with not enum files
- fixed error of annotation command with string backed enum
- enum-helper v2 dependency
- annotation generator command
- refactoring
- pint, larastan
- fix phpDoc
- Laravel 11 support
Laravel 10 support
- v1.0.0 release 🚀 🎉
- update requirements
After migrating several projects with my fellow @RobertoNegro and listening to different opinions we have decided to simplify the package. From now on, I will consider a pure enum as a StringBackedEnum with names as values, so all ***AsSelect() methods will be replaced by ***ByValue() methods.
- added definition of
description()
,descriptions()
,descriptionsByName()
,descriptionsByValue()
to improve code completion and static analysis - removed all methods `***AsSelect()
- removed
NotBackedEnum
exception - added support on
***ByValue()
methods also for pure enum using name instead value - merged version number with datomatic/enum-helper
- refactored
humanize
case string method - added test to cover all cases
- refactored documentation
- added a fallback to the case name on
description
"property"
- improved the TranslationMissing exception message
- fixed error with
IntBackedEnum
refactoring by @eppak
- changed the translation key from
name
toname/value
for using the more comfortable invokable functionality on enums.php - added a translation fallback for description property translations
Example of new translation file
// /lang/it/enums.php
return [
// If you need to translate just the description property
Status::class => [
Status::PENDING() => 'In attesa', // using invokable trait functionality
'ACCEPTED' => 'Accettato', // using the name of pure enum case
'DISCARDED' => 'Rifiutato',
'NO_RESPONSE' => 'Nessuna Risposta',
],
// If you need to translate multiple properties (e.g. description, excerpt)
StatusString::class => [
'description' => [ // using invokable trait functionality
StatusString::PENDING() => 'In attesa',
StatusString::ACCEPTED() => 'Accettato',
...
],
'excerpt' => [ // using the value of BackedEnum case
"P" => 'In attesa',
"A" => 'Accettato',
...
- rename
LaravelEnum
trait inLaravelEnumHelper
- fixed return of invokable static call on IntBackedEnum
- permit to use of "property" name that has name both singular and plural
- updated banners
First release 🚀