stephanbouman / enumcollection
Lets add collections into Enums
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/stephanbouman/enumcollection
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(...)