1. Go to this page and download the library: Download oskarstark/enum-helper 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/ */
oskarstark / enum-helper example snippets
declare(strict_types=1);
namespace App\Enum;
enum Color: string
{
case RED = 'red';
case BLUE = 'blue';
}
declare(strict_types=1);
namespace App\Enum;
use OskarStark\Enum\Trait\Comparable;
use OskarStark\Enum\Trait\ToArray;
enum Color: string
{
use Comparable;
use ToArray;
case RED = 'red';
case BLUE = 'blue';
case GREEN = 'green';
public function isNice(): bool
{
return self::equalsOneOf([
self::BLUE,
self::GREEN
]);
}
}