PHP code example of outerweb / enum-helpers

1. Go to this page and download the library: Download outerweb/enum-helpers library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

outerweb / enum-helpers example snippets


use Outerweb\EnumHelpers\HasCollectionSupport;

enum Status: string
{
    use HasCollectionSupport;

    const Open = 'open';
    const Closed = 'closed';

    public function label(): string
    {
        return match ($this->value) {
            self::Open => 'Open',
            self::Closed => 'Closed',
        };
    }
}

Status::collect();

Status::collect('label');