Download the PHP package jefhar/laravel-export-constants without Composer
On this page you can find all versions of the php package jefhar/laravel-export-constants. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jefhar/laravel-export-constants
More information about jefhar/laravel-export-constants
Files in jefhar/laravel-export-constants
Package laravel-export-constants
Short Description Export your PHP class constants to JavaScript
License MIT
Homepage https://github.com/jefhar/laravel-export-constants
Informations about the package laravel-export-constants
Duplicate PHP Constants in JavaScript
Requires Laravel ^9.0 and PHP ^8.0
Like you, I hate bare strings and magic numbers in code, so we use PHP constants. With the magic of Attributes, your PHP constants can be duplicated for use in your Vue, React, and POJS
Installation
You can install the package via composer:
Copy the package config to your local config with the publish command:
Usage
Add the attribute #[\LaravelExportConstants\Attributes\ExportToJs]
to your public
constants and add the blade directive @constants
to your app.blade.php
file. Use
your PHP constant as normal, and look for your JavaScript constant under the
CONSTANTS
global constant
Testing
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
- Jeff Harris
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.