stephanbouman/enumcollection

There is no license information available for the latest version (v1.0.0) of this package.

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

v1.0.0 2023-11-30 21:40 UTC

This package is auto-updated.

Last update: 2025-09-29 03:07:28 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(...)