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

This package is auto-updated.

Last update: 2024-04-30 00:56:57 UTC


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(...)