New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

kkszymanowski/laravel-js-config

Publish Laravel configuration to JS
9,351

Larablocks Analysis

kkszymanowski/laravel-js-config works with Laravel 5 to 9 (latest release 1.0.9, Oct 24, 2022), all past end of life (the last on Feb 6, 2024): no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5 to 9, past end of life since Feb 6, 2024
  • No release in the last 12 months (last: Oct 24, 2022)
  • 451 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Oct 24, 2022.
  • No releases in the last 12 months.
  • First released: Sep 5, 2017.
  • Monthly downloads: 451, up 92% from six months ago.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require kkszymanowski/laravel-js-config
Latest Version:1.0.9
PHP:^7.1|8.*
Laravel:5 – 9
License:MIT
Last Updated:Oct 24, 2022
Links: GitHub  ·  Packagist
Maintainer: KKSzymanowski

Laravel-JS-Config

Easily publish your Laravel configuration to JavaScript.

Requirements
  • PHP 7.*
  • Laravel >= 5.2
Installation
composer require kkszymanowski/laravel-js-config

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
php artisan vendor:publish
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
php artisan config:js
Integration with Laravel Mix

To publish the configuration every time the Mix build starts follow these steps:

  1. Install webpack-shell-plugin:
    # NPM
    npm install webpack-shell-plugin --save-dev
    
    # Yarn
    yarn add webpack-shell-plugin 
    
  2. In your webpack.mix.js file require the plugin
    const WebpackShellPlugin = require('webpack-shell-plugin');
    
    and register it to run before each build
    mix.webpackConfig({
        plugins: [
            new WebpackShellPlugin({
                onBuildStart: ['php artisan config:js'],
            }),
        ],
    });
    

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.

Related Packages

laracasts/utilities

Transform your PHP to JavaScript

11,249,900 2,193
laravel-dev-common/union-config

Laravel dev config util

209 0
jani/laravel-db-config

laravel 读写数据库Config,基于Laravel5.1插件。

42 0
pragmarx/yaml

Load your Laravel config files using yaml

2,965,968 114
anourvalar/config-helper

Helper functions over Laravel config

12,031 0

Version History

Version Released PHP Laravel License
1.0.9 ^7.1|8.* >=5.2.0 MIT
1.0.8 ^7.1|8.* ~5.2|6.*|7.*|8.* MIT
1.0.7 ^7.1 ~5.2|6.*|7.* MIT
1.0.6 ^7.1 ~5.2|6.* MIT
1.0.5 7.* ~5.2 MIT