New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

dalholm/laravel-settings

Database settings package for Laravel
1,444
Install
composer require dalholm/laravel-settings
Latest Version:v0.9
PHP:^8.3
Laravel:11 · 12
Older releases:8 · 9 · 10
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

pixeo/laravel-settings

Simple persisting settings package for a Laravel application

3,073 2
akaunting/laravel-setting

Persistent settings package for Laravel

1,007,187 490
agenter-labs/illuminate-setting

Persistent settings package for Laravel

6,156 0
illuminatech/nova-config

A Laravel Nova tool for application configuration management.

4,665 13
jesprna/jaysfi-setting

Persistent settings package for Laravel

2,027 0

Version History

Version Released PHP Laravel License
v0.9 ^8.3 ^11.0|^12.0 MIT
v0.8 ^8.3 ^12.0 MIT
v0.7 ^8.3 ^12.0 MIT
v0.6 ^8.3 ^11.0 MIT
v0.5 ^8.3 ^11.0 MIT