laravel-settings maintained by itmosoft
ITMOSOFT Laravel Settings
A reusable, database-backed application settings package for Laravel.
Requirements
- PHP 8.3+
- Laravel 12
- A database supported by Laravel
Installation
Install the package through Composer:
composer require itmosoft/laravel-settings
Run the package migrations:
php artisan migrate
Optionally publish the package configuration:
php artisan vendor:publish --tag=itmosoft-settings-config
The configuration file will be created at
config/itmosoft-settings.php.
Usage
Import the facade:
use ItmoSoft\Settings\Facades\Settings;
Store a setting
Settings::set('site_name', 'ITMOSOFT');
Settings::set('maintenance_mode', false);
Settings::set('supported_languages', ['en', 'ur']);
Retrieve a setting
$siteName = Settings::get('site_name', 'My Website');
$maintenanceMode = Settings::get('maintenance_mode', false);
$languages = Settings::get('supported_languages', ['en']);
Check whether a setting exists
if (Settings::has('site_name')) {
// The setting exists.
}
Delete a setting
$deleted = Settings::forget('site_name');
forget() returns true when a record was deleted and false when the
key did not exist.
Configuration
The default configuration is:
return [
'table' => 'itmosoft_settings',
];
You can change the table name in config/itmosoft-settings.php after
publishing the configuration.
Development
Install development dependencies:
composer install
Run the automated tests:
./vendor/bin/phpunit
The test suite uses Orchestra Testbench and an in-memory SQLite database.
Current scope
Version 1 focuses on simple application-wide settings. It does not currently provide a settings dashboard, user-specific settings, caching, or permission management.
License
This package is open-source software licensed under the MIT License.