michielkempen/laravel-enum

1.0.1 2021-03-04 20:27 UTC

This package is auto-updated.

Last update: 2024-11-05 04:18:24 UTC


README

A strongly typed enum class for PHP that supports autocompletion and refactoring.

Installation

Add the package to the dependencies of your application

composer require michielkempen/laravel-enum

Usage

<?php

use MichielKempen\LaravelEnum\Enum;

class ExampleEnum extends Enum
{
    const TYPE_A = 'a';
    const TYPE_B = 'b';
    const TYPE_C = 'c';
}
<?php

ExampleEnum::TYPE_A; // outputs 'a'

ExampleEnum::TYPE_B; // outputs 'b'

ExampleEnum::all(); // outputs ['a', 'b', 'c']

Security

If you discover any security related issues, please email kempenmichiel@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.