PHP code example of synergitech / laravel-magic-enums
1. Go to this page and download the library: Download synergitech/laravel-magic-enums 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/ */
synergitech / laravel-magic-enums example snippets
namespace App\Enums;
use SynergiTech\MagicEnums\Interfaces\MagicEnum;
use SynergiTech\MagicEnums\Traits\HasMagic;
enum YourEnum: string implements MagicEnum
{
use HasMagic;
...
use Illuminate\Support\Facades\Route;
use SynergiTech\MagicEnums\Facades\MagicEnumsRouteFacade;
Route::prefix('/api')->group(function () {
MagicEnumsRouteFacade::enumsController();
});
namespace App\Enums;
use SynergiTech\MagicEnums\Attributes\AppendConstToMagic;
use SynergiTech\MagicEnums\Attributes\AppendValueToMagic;
use SynergiTech\MagicEnums\Interfaces\MagicEnum;
use SynergiTech\MagicEnums\Traits\HasMagic;
enum TestingEnum: string implements MagicEnum
{
use HasMagic;
case First = 'first';
case Second = 'second';
case Third = 'third';
#[AppendConstToMagic]
public const JUST_ONE = [
self::First,
];
#[AppendValueToMagic]
public const COLOUR = [
self::First->value => 'red',
];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.