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.
- Support Laravel 5+.
- Allow to specify desired wildcard keys who will not converted to JS.
- Settings will generated by package:
oriceon/laravel-settings
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
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.
php artisan settings:js
php artisan settings:js public/assets/dist/settings.dist.js
php artisan settings:js -c
php artisan settings:js --json
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.
<?php
return [
'exclude_keys' => [
'smtp_*',
],
];
This is a quick documentation regarding this package
Settings.get('foo');
Settings.get('foo', 'bar');
Settings.has('foo');
You will need to have installed the following softwares.
- Composer.
- PHP 7+.
After getting all the required softwares you may run the following commands to get everything ready:
- Install PHP dependencies:
composer install
Please see CONTRIBUTING for details.
Please e-mail [email protected] to report any security vulnerabilities instead of the issue tracker.
The MIT License (MIT). Please see License File for more information.