Laravel settings management package using database and laravel config()
ibraheem-ghazi/laravel-settings-manager is a Laravel package for laravel settings management package using database and laravel config().
It currently has 15 GitHub stars and 138 downloads on Packagist (latest version 1.71).
Install it with composer require ibraheem-ghazi/laravel-settings-manager.
Discover more Laravel packages by ibraheem-ghazi
or browse all Laravel packages to compare alternatives.
Last updated
This is a Laravel package provide an easy way to control application settings, which can easily integrated to application configuration to be used with config() function
This package was built for versions >= 7.0 but also compatible with versions >= 5.8.16
composer require ibraheem-ghazi/laravel-settings-manager
then:
php artisan migrate
if your installed laravel version does not support auto discover packages then:
1- add this provider to config:
IbraheemGhazi\SettingsManager\Providers\SettingsServiceProvider::class,
2- then add alias:
'Settings' => IbraheemGhazi\SettingsManager\Facades\Settings::class,
|func | description| |----------------------------------|----------------------| |$ignoreMigration | ignore auto register package migrations. |$AutoLoadFromDatabase | disable/enable auto loading configuration from database. |$AutoSaveOnSet | disable/enable auto save configuration to database. |$AutoCreateOnSave | disable/enable auto create configuration to database if not already exists. |$Model | change the model used to save settings - must have key, value fields where key is primary key.
|func | params | description| |----------------------------------|----------------|----------------------| |bind | string $settings_key, ?string $config_key = NULL | bind a settings entry from DB to application configuration key |unbind | string $settings_key | remove binding of a settings entry to application configuration key
|func | params | return | description| |------------------------|---------------------|---------------|----------------------| |load | bool $force = false | ($this) | load settings from DB (or force reload it) |getModel | - | Model | return the model used to control DB entries |getBindings | - | Collection | get all configured settings to configurations bindings |all | - | Collection | return collection of strings of all entries. |get | $key, $default=NULL | mixed | return the value of specified key |set | $key, $value, $save = false, $should_create = true | ($this) | set the value for specified key, (with option to force enable/disable saving or creating) |forget | $key, $permanent_remove = true, $callback = NULL | ($this) | remove the specified key, (with option to force enable/disable removing entry from DB, and call a callback function when done removing)