Simply PHP enum

2.0.0 2020-05-01 11:06 UTC

This package is auto-updated.

Last update: 2024-05-29 04:48:14 UTC


README

Enum gives the ability to emulate and create enumeration objects in PHP.

INSTALL

composer require darkdevlab/enum

USAGE

use DarkDevLab\Enum\Tests\ExampleEnum;

// Usage with always object creation
$e = new ExampleEnum(ExampleEnum::ONE);
var_dump($e->getValue()); // (int) 1

// Usage with memory container (object will created only once)
$e = ExampleEnum::get(ExampleEnum::OTHER);
var_dump($e->getValue()); // (string) 'other'