gearbox-solutions/enum-converter-laravel

This is my package enum-converter-laravel

0.0.3 2025-05-23 19:48 UTC

This package is auto-updated.

Last update: 2025-06-03 14:31:15 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.