PHPackages                             vildanbina/laravel-js-settings - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. vildanbina/laravel-js-settings

ActiveLibrary[Localization &amp; i18n](/categories/localization)

vildanbina/laravel-js-settings
==============================

Laravel Settings in JavaScript

v1.0(4y ago)242MITPHPPHP ^5.4 || ^7.0

Since Aug 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/vildanbina/laravel-js-settings)[ Packagist](https://packagist.org/packages/vildanbina/laravel-js-settings)[ Docs](https://github.com/vildanbina/laravel-js-settings)[ RSS](/packages/vildanbina-laravel-js-settings/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/4b0baa8a846832ba983ed587e9831d0517a8b7199b00bb5f570460c10904a7c9/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d6a732d73657474696e67732f76)](https://packagist.org/packages/vildanbina/laravel-js-settings)[![Total Downloads](https://camo.githubusercontent.com/6021d09fc898a028db20c2c7a4b8559552a2c80f818f112a672c251f986cbac3/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d6a732d73657474696e67732f646f776e6c6f616473)](https://packagist.org/packages/vildanbina/laravel-js-settings)[![Latest Unstable Version](https://camo.githubusercontent.com/c34b88ef513c462001bcfeb4b7551d141c3f5b888ffe29667827dc4cc0030d42/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d6a732d73657474696e67732f762f756e737461626c65)](https://packagist.org/packages/vildanbina/laravel-js-settings)[![License](https://camo.githubusercontent.com/f7454abd83fbd8e4efd0c6e89c95c3f56f96d7256c75b3123e2e1fbd026ea20a/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d6a732d73657474696e67732f6c6963656e7365)](https://packagist.org/packages/vildanbina/laravel-js-settings)[![PHP Version Require](https://camo.githubusercontent.com/4c9851b0aeaa62f1f9e31999219fdd92e3c6b4ac0a5dc534ae078c4b6ef05e3e/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d6a732d73657474696e67732f726571756972652f706870)](https://packagist.org/packages/vildanbina/laravel-js-settings)

This package convert all your setting key and values who generated (`oriceon/laravel-settings`) from your Laravel app to JavaScript with a small library to interact with those settings following a very similar syntax you are familiar with.

Features
--------

[](#features)

- Support Laravel 5+.
- Allow to specify desired wildcard keys who will not converted to JS.
- Settings will generated by package: `oriceon/laravel-settings`

Installation
------------

[](#installation)

```
composer require vildanbina/laravel-js-settings
```

In your Laravel app go to `config/app.php` and add the following service provider:

```
vildanbina\SettingsJs\LaravelJsSettingsServiceProvider::class
```

Usage
-----

[](#usage)

The `Laravel-JS-Settings` package provides a command that generate the JavaScript version of all your settings. The resulting JavaScript file will contain all your settings.

### Generating JS settings

[](#generating-js-settings)

```
php artisan settings:js
```

### Specifying a custom target

[](#specifying-a-custom-target)

```
php artisan settings:js public/assets/dist/settings.dist.js
```

### Compressing the JS file

[](#compressing-the-js-file)

```
php artisan settings:js -c
```

### Output a JSON file instead.

[](#output-a-json-file-instead)

```
php artisan settings:js --json
```

Configuration
-------------

[](#configuration)

First, publish the default package's configuration file running:

```
php artisan vendor:publish --provider="vildanbina\SettingsJs\LaravelJsSettingsServiceProvider"
```

The configuration will be published to `config/settings-js.php`.

You may edit this file to define the setting key you exclude in your Javascript code. Just edit the `exclude_keys` array in the config file.

```
