Repository navigation
This is a major release. It contains breaking changes: read Changed and Removed before upgrading from 1.x. A constraint of ^1.0 does not pick this version up; change it to ^2.0.
Added
- Public API: Expose
BaseEnum::isLocalizable()as a public capability check. - Documentation: Add topic guides and a bundled coding-agent skill covering package usage.
- CI: Add GitHub Actions checks for tests and code style.
Changed
These entries change behaviour that existing code may rely on. Each one names what to adjust.
- Breaking, casts: A case of another enum is rejected with
ItemNotFoundException, even if
its value matches a case of the cast's enum. Earlier releases stored it unchecked. Assign a
case of the cast's enum or a raw value. - Breaking, casts: A
:collectionattribute stored as JSON throwsUnexpectedValueException
when the column holds anything but a JSON array. Earlier releases read invalid JSON and a JSON
nullas an empty list and wrapped a JSON scalar into a list. An empty string still reads as
an empty list. Repair such rows before upgrading. - Breaking, casts:
:collection,commathrowsInvalidArgumentExceptionwhen writing a
string value that is empty, contains a comma or has surrounding whitespace. Use the default
JSON storage for enums with such values. - Breaking, helpers: Non-strict
hasValue()and the non-strictEnumValuerule compare ints
and strings only.true,1.0andnullno longer match the values1,1and''. - Breaking, Livewire:
fromLivewire()throwsInvalidArgumentExceptionfor a payload
without an int or stringvalue. Earlier releases raised a warning and resolved such a
payload to the case with the value0or''if the enum had one. - Breaking, JavaScript:
asServableEnum()and<x-m2-enums::serve />keep the string type
of numeric-string backing values, sovalueis"10"where it used to be10. Compare
against the string in JavaScript.
Fixed
- Casts: Correct comma serialization and parsing, preserve zero-valued cases, and store an
array with gaps in its keys as a JSON list instead of a JSON object. - Validation:
EnumNameand non-strictEnumValuefail validation for array input instead
of raising an error. - Localization: Fall back to raw names without a bound translator while supporting a
translator swapped directly onto theLangfacade. - Livewire/JavaScript: Accept arrays returned by
toLivewire()and correct the published
Blade component name. - Build: Include the README-linked documentation in Composer distribution archives.
Removed
- Breaking, helpers: Remove
__invoke()fromBaseEnum, so cases are no longer callable.
Laravel's collection methods treat a callable argument as a callback, which made
collect($roles)->contains(UserRole::ADMIN)return a wrong result. Replace$role()with
$role->value. The static shortcutUserRole::ADMIN()is unchanged. - CI: Remove the obsolete Travis CI and Scrutinizer configurations.
- Build: Remove repository-only image assets from Composer distribution archives.