Skip to content

Releases: datomatic/enum-helper

v0.4.0

14 Jun 07:46
Compare
Choose a tag to compare

Renamed these methods:

  • namesArray() => namesByValue()
  • valuesArray() => valuesByName()

descriptionsArray() splitted into 2 methods descriptionsByName(), descriptionsByValue()

Renamed EnumLaravelLocalization trait to LaravelEnum

Added new [method]AsSelect() methods that return [method]ByValue() if is BackedEnum, [method]ByName() otherwise.

Added these exceptions:

  • NotBackedEnum
  • EmptyCases
  • UndefinedStaticMethod

Added dynamic methods on LaravelEnum trait

v0.3.1

30 May 13:46
Compare
Choose a tag to compare
  • Fixed README.md
  • added return type on InvalidUniqueId exception

v0.3.0

30 May 12:47
Compare
Choose a tag to compare
  • Merge translations and descriptions
  • Move UniqueId out of EnumHelper

v0.2.0

27 May 12:35
e1f6939
Compare
Choose a tag to compare

Enum Helper (v0.2.0)
A simple and opinionated collections of PHP 8.1 enum helpers

  • Invokable cases: get the value of enum "invoking" it statically
  • Construct enum by name or value: from(), tryFrom(), fromName(), tryFromName() for all enums
  • Enums Equality: is(), isNot(), in(), notIn() methods
  • Names: methods to have a list of case names (names(), namesArray())
  • Values: methods to have a list of case values (values(), valuesArray())
  • Unique ID: get an unique identifier from instance or instance from identifier (uniqueId(), fromUniqueId())
  • Descriptions: add description method and relative utilities to an enum (description(),descriptions(),descriptionsArray())
  • Translations: use enums on a multilanguage project (translate(),translations(),translationsArray())