Download the PHP package intrfce/laravel-frontend-enums without Composer
On this page you can find all versions of the php package intrfce/laravel-frontend-enums. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download intrfce/laravel-frontend-enums
More information about intrfce/laravel-frontend-enums
Files in intrfce/laravel-frontend-enums
Package laravel-frontend-enums
Short Description Stop using 'magic' strings/numbers in your frontend Javascript and use your actual application enums instead.
License MIT
Homepage https://github.com/intrfce/laravel-frontend-enums
Informations about the package laravel-frontend-enums
Laravel Frontend Enums
Publish your PHP enums to the frontend of our application so you can refer to them in your JavaScript code.
Installation
You can install the package via composer:
Usage
In your AppServiceProvider.php
, tell the package which Enums you want to publish:
Then run the publish command:
Your enums will be waiting at the path you specified with the extension .enum.js
:
You can then import and use them in your JavaScript code:
Typescript Support
Typescript support is baked in: just add ->asTypescript()
to the list of enums in your AppServiceProvider.php
:
Files will be output as .ts
files and Typescript native enums:
Automatically generate javascript files on change.
You can use the vite-plugin-watch
package from lepikhinb to automatically generate your javascript files when you make changes to your PHP enums:
Then add the plugin to your vite.config.js
:
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Dan Matthews
- All Contributors
License
The MIT License (MIT). Please see License File for more information.