Search by

egough / laravel-settings

egough

Database-backed application and model settings for Laravel.

Package info

github.com/realedwardgough/laravel-settings

pkg:composer/egough/laravel-settings

Statistics

Installs: 1 124

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 0

v1.4.1 2026-10-27 20:06 UTC

This package is auto-updated.

Last update: 2026-10-31 16:20:08 UTC


README

alt text

Latest Version on Packagist Total Downloads License Tests

Add global and per-model settings for your Laravel application.

Settings are stored in the database, automatically cached for performance, and exposed through a clean, expressive API including a global helper, a facade, Blade directives, and support for dependency injection.

Provides a simple, typed and cacheable way to store dynamic configuration outside of .env and static config files, including per-model settings such as user or team preferences.

View the documentation

Quick Example

// Application setting
settings()->set('site.name', 'My Application');

settings()->get('site.name');


// Model-specific setting
$user->settings()->set('ui.theme', 'dark');

$user->settings()->get('ui.theme');


// Feature flag
if (flag('billing.enabled')) {
    // Feature enabled
}

Adding to your model:

use Egough\LaravelSettings\Traits\HasSettings;

class User extends Authenticatable
{
    use HasSettings;
}

Blade usage:

@hasFlag('billing.enabled')
    <x-billing-panel />
@endhasFlag

<title>@setting('site.name')</title>

Installation

composer require egough/laravel-settings:^1.0

Publish configuration and migrations:

php artisan vendor:publish --tag=settings-config
php artisan vendor:publish --tag=settings-migrations
php artisan vendor:publish --tag=settings-model-migrations
php artisan migrate

Requirements

  • PHP 8.2+
  • Laravel 10, 11, 12, or 13

License

MIT