PHP code example of saas-laravel / laravel-enums-to-json
1. Go to this page and download the library: Download saas-laravel/laravel-enums-to-json 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/ */
saas-laravel / laravel-enums-to-json example snippets
return [
// The disk, defined in filesystem.php, where json files will be stored
'disk' => 'public',
// The folder on that disk where json will be generated
'path' => '/shared',
'enum_locations' => [
app_path(),
],
];
namespace App\Enums;
use SaasLaravel\LaravelEnumsToJson\Attributes\EnumToJson;
#[EnumToJson] //add attribute
enum CastType: int
{
case Boolean = 0;
case Integer = 1;
case String = 2;
// (optional) A way to customize the generated file name
public static function jsonFileName(): string
{
return 'cast';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.