This package adds a command that will take PHP enums and turn them into TS/JS enums for use in frontend development.
You can install the package via composer:
composer require --dev gearbox-solutions/enum-converter-laravel
You can publish the config file with:
php artisan vendor:publish --tag="enum-converter-laravel-config"
This is the contents of the published config file:
return [
/*
* relative paths from the project root
*/
'enum_paths' => [
'app/Enums' => 'resources/js/types/enums',
// 'input/folder' => 'output/folder'
],
/*
* extension to use for the enum files
*/
'enum_extension' => '.ts',
/*
* Enable File hash check
* - adds a hash check to determine if a file has changed to speed up performance
*/
'enable_file_hash_check' => true,
];
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.