brnysn / laravel-settings
The simplest way to use system settings in Laravel application.
1.0.1
2022-09-14 10:22 UTC
Requires
- php: ^8.0
- laravel/framework: ^9
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
README
Installation
You can install the package via composer:
composer require brnysn/laravel-settings
You can publish the config file with:
php artisan vendor:publish --tag="settings-config"
This is the contents of the published config file:
return [ // 'sample' => 'setting', ];
Add middlewares to your app/Http/Kernel.php
file $middlewareGroups
array in web
group:
protected $middlewareGroups = [ 'web' => [ // ... \Brnysn\LaravelSettings\Http\Middleware\SettingsMiddleware::class, ], // ... ];
Usage
Get all settings:
use Brnysn\LaravelSettings\Settings; Settings::all();
Get setting by key:
use Brnysn\LaravelSettings\Settings; Settings::get('key');
Set setting by key:
use Brnysn\LaravelSettings\Settings; Settings::set('key', 'value');
Delete setting by key:
use Brnysn\LaravelSettings\Settings; Settings::delete('key');
Check if setting exists:
use Brnysn\LaravelSettings\Settings; Settings::has('key');
Flush all settings:
use Brnysn\LaravelSettings\Settings; Settings::flush();
Use named api routes to see and change settings:
settings.index settings.update
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.