Download the PHP package kkszymanowski/laravel-js-config without Composer
On this page you can find all versions of the php package kkszymanowski/laravel-js-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kkszymanowski/laravel-js-config
More information about kkszymanowski/laravel-js-config
Files in kkszymanowski/laravel-js-config
Package laravel-js-config
Short Description Publish Laravel configuration to JS
License MIT
Informations about the package laravel-js-config
Laravel-JS-Config
Easily publish your Laravel configuration to JavaScript.
Requirements
- PHP 7.*
- Laravel >= 5.2
Installation
On Laravel < 5.5 add LaravelJsConfig\LaravelJsConfigServiceProvider::class
to app/config.php
.
On Laravel >= 5.5 the service provider should be automatically discovered.
Publish assets
Configure
In config/js-config.php
there are following configuration options.
Output
Path of the output file generated from the command. By default resources/assets/js/config.js
Pretty
If true, the command will format the JSON configuration using JSON_PRETTY_PRINT
.
Keys
List of configuration keys to be published.
Can be either a specific key(like app.env
) or a group of keys(like auth.defaults
)
Make sure you don't publish your application key or any passwords.
Run
Integration with Laravel Mix
To publish the configuration every time the Mix build starts follow these steps:
-
Install
webpack-shell-plugin
: -
In your
webpack.mix.js
file require the pluginand register it to run before each build
If you're using the watch
option in Laravel Mix and you want to refresh the published configuration you can either restart the build or run php artisan config:js
in another terminal.
All versions of laravel-js-config with dependencies
illuminate/support Version >=5.2.0
illuminate/console Version >=5.2.0
illuminate/filesystem Version >=5.2.0