gearbox-solutions / enum-converter-laravel
This is my package enum-converter-laravel
Fund package maintenance!
GearboxSolutions
Requires
- php: ^8.3
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
This package adds a command that will take PHP enums and turn them into TS/JS enums for use in frontend development.
Installation
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, ];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.