stri8ed/laravel-config-js
最新稳定版本:v1.0.2
Composer 安装命令:
composer require stri8ed/laravel-config-js
包简介
Laravel package for exposing configs in JS
README 文档
README
A Laravel package that exposes your Laravel configuration values to JavaScript.
Installation
composer require stri8ed/laravel-config-js
Usage
In your Blade views, use the @configJs directive to expose specific config values:
@configJs('app.name')
This creates a global laravelConfig() function that you can use in JavaScript:
// Get a single config value const appName = laravelConfig('app.name'); // With a default value const debug = laravelConfig('app.debug', false);
You can expose multiple config values:
@configJs(['app.name', 'app.env', 'services.api.key'])
Configuration
Optionally publish the config file to customize the JavaScript function name:
php artisan vendor:publish --tag="config-js"
License
MIT
统计信息
- 总下载量: 126
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-19