dalholm/laravel-settings

Database settings package for Laravel
1,207
Install
composer require dalholm/laravel-settings
Latest Version:v0.9
PHP:^8.3
License:MIT
Last Updated:Jul 4, 2025
Links: GitHub  ·  Packagist
Maintainer: dalholm

Laravel database settings package

Latest Version on Packagist Total Downloads

Simple and powerful settings package for laravel with fallback and cache option.

Installation

You can install the package via composer:

composer require dalholm/laravel-settings

Publish

php artisan vendor:publish --tag=laravel-settings

Config

/*
 * You can place your custom package configuration in here.
 */
return [

    /*
    |--------------------------------------------------------------------------
    | Cache
    |--------------------------------------------------------------------------
    | Cache is only working with redis and uses cache tags
    |
    */

    'cache' => [
        'enabled' => env('SETTINGS_CACHE_ENABLED', false),
        'profile' => Dalholm\LaravelSettings\Cache\CacheProfile::class,
        'store' => null,
    ],

    /*
    |--------------------------------------------------------------------------
    | Database settings
    |--------------------------------------------------------------------------
    | You could use what ever you want
    |
    */
    'database' => [
        'connection'    => null,
        'table'         => 'settings',
        'key'           => 'key',
        'value'         => 'value',
    ],

    /*
    |--------------------------------------------------------------------------
    | Fallback
    |--------------------------------------------------------------------------
    | Use this as a fallback if settings is not yet available in database
    |
    | Example:
    |       "power" => "is-on"
    |
    */

    'fallback' => [
        //
    ],

];

Usage

// Create / update setting or settings
// Settings will automatically update database and replace cache
settings(['key' => 'value']);


// Create / update multple
settings([
   'key 1' => 'value 1',
   'key 2' => 'value 2',
   'key 3' => 'value 3',
   // etc 
]);


// Get
settings('key');

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email mikael@dalholm.se instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

Related Packages

buzz/laravel-setting

Package changes config for laravel 5.*

1,098 1
d3lph1/laravel-configger

Persistent settings for your Laravel app

628 1
arcanedev/laravel-settings

This package allows you to persists configs/settings for Laravel projects.

143,099 74
arcanesoft/settings

Persistent settings for ARCANESOFT CMS.

2,574 1
danielrhodeswarp/kimino-config

Easy configuration setting and getting for Laravel projects

45 0