PHP code example of rocksheep / enum-helpers
1. Go to this page and download the library: Download rocksheep/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/ */
rocksheep / enum-helpers example snippets
use Rocksheep\EnumHelpers\EnumToArray;
enum YourEnum: string
{
use EnumToArray;
case Example = 'example';
}
use Rocksheep\EnumHelpers\Attributes\Hidden;
use Rocksheep\EnumHelpers\EnumToArray;
enum YourEnum: string
{
use EnumToArray;
case Visible = 'visible';
#[Hidden]
case Hidden = 'hidden';
}
$array = YourEnum::toArray(); // ['visible' => 'Visible']