stephanbouman / enumcollection
There is no license information available for the latest version (v1.0.0) of this package.
Lets add collections into Enums
v1.0.0
2023-11-30 21:40 UTC
Requires
- illuminate/collections: ^10.34
Requires (Dev)
- laravel/pint: ^1.13
- phpunit/phpunit: ^10.4
README
This package adds a asCollection()
method to your enums. Now you don't need to wrap your Enum::cases()
in a collection.
How to implement
use Stephanbouman\Enumcollection\HasCollection; enum TestEnum { use HasCollection; // use the HasCollection trait case Foo; case Bar; }
How to use
// instead of collect(Fruits::cases())->filter(...) // use Fruits::asCollection()->filter(...)