PHPackages                             elegantly/laravel-settings - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. elegantly/laravel-settings

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

elegantly/laravel-settings
==========================

Settings for your Laravel App

v1.2.0(3mo ago)92.7k↑51.1%MITPHPPHP ^8.3CI passing

Since Apr 28Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ElegantEngineeringTech/laravel-settings)[ Packagist](https://packagist.org/packages/elegantly/laravel-settings)[ Docs](https://github.com/ElegantEngineeringTech/laravel-settings)[ GitHub Sponsors](https://github.com/ElegantEngineeringTech)[ RSS](/packages/elegantly-laravel-settings/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (24)Versions (4)Used By (0)

Elegant Global Settings Management in Laravel
=============================================

[](#elegant-global-settings-management-in-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/eb2de435ee7bd85ce1b2813859114b1d2484c486eaf06eaf1a9162e06c88179f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6567616e746c792f6c61726176656c2d73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elegantly/laravel-settings)[![Tests](https://camo.githubusercontent.com/7d8992be6e1d177a3e5298d7fc25df6cab96a25be750faffcd356f898af62c95/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f456c6567616e74456e67696e656572696e67546563682f6c61726176656c2d73657474696e67732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ElegantEngineeringTech/laravel-settings/actions?query=workflow%3Arun-tests+branch%3Amain)[![Code Style](https://camo.githubusercontent.com/93dfadbc9bc1d0bce048759f363eeb03b55e85d4019a92a0b2cb049818688320/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f456c6567616e74456e67696e656572696e67546563682f6c61726176656c2d73657474696e67732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ElegantEngineeringTech/laravel-settings/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![PHPStan Level](https://camo.githubusercontent.com/e09bbb714e63a96c1209fdfdb218e546d5e68ab2b35178e325a91d59ae551dd0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f456c6567616e74456e67696e656572696e67546563682f6c61726176656c2d73657474696e67732f7068707374616e2e796d6c3f6c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/ElegantEngineeringTech/laravel-settings/actions?query=workflow%3Aphpstan)[![Laravel Pint](https://camo.githubusercontent.com/6e921f762a0b758d5b851d2622edcd51d31c48720e83821dbd860ca753e3a92d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f456c6567616e74456e67696e656572696e67546563682f6c61726176656c2d73657474696e67732f70696e742e796d6c3f6c6162656c3d6c61726176656c25323070696e74267374796c653d666c61742d737175617265)](https://github.com/ElegantEngineeringTech/laravel-settings/actions?query=workflow%3Apint)[![Total Downloads](https://camo.githubusercontent.com/42de3d41c129939def45fe501d0804028060244a24d9ec0dcfa8bbf378d2397e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6567616e746c792f6c61726176656c2d73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elegantly/laravel-settings)

A simple and flexible way to manage global or model-specific settings in your Laravel app.

---

Features
--------

[](#features)

- Define global settings
- Store settings in the database via Eloquent
- Cache settings for performance
- Attach settings to users or any other model
- Support for typed namespaced settings classes

---

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)

    - [Basic Usage (Facade)](#basic-usage-facade)
    - [Dependency Injection](#dependency-injection)
    - [Typed Namespaced Settings](#typed-namespaced-settings)
- [Testing](#testing)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security](#security-vulnerabilities)
- [Credits](#credits)
- [License](#license)

---

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require elegantly/laravel-settings
```

Publish the migration and run it:

```
php artisan vendor:publish --tag="settings-migrations"
php artisan migrate
```

Optionally, publish the configuration file:

```
php artisan vendor:publish --tag="settings-config"
```

---

Configuration
-------------

[](#configuration)

Published config file (`config/settings.php`):

```
use Elegantly\Settings\Models\Setting;

return [

    /*
     * The Eloquent model used to store and retrieve settings
     */
    'model' => Setting::class,

    /*
     * Cache configuration for global settings
     */
    'cache' => [
        'enabled' => true,
        'key' => 'settings',
        'ttl' => 60 * 60 * 24, // 1 day
    ],

];
```

---

Usage
-----

[](#usage)

### Basic Usage (Facade)

[](#basic-usage-facade)

```
use Elegantly\Settings\Facades\Settings;

// Set a value
Settings::set(
    namespace: 'home',
    name: 'color',
    value: 'white'
);

// Get a value
$setting = Settings::get(
    namespace: 'home',
    name: 'color'
);

$setting->value; // white
```

### Dependency Injection

[](#dependency-injection)

```
namespace App\Http\Controllers;

use Elegantly\Settings\Settings;

class UserController extends Controller
{
    public function index(Settings $settings)
    {
        $settings->set(
            namespace: 'home',
            name: 'color',
            value: 'white'
        );

        $setting = $settings->get(
            namespace: 'home',
            name: 'color'
        );

        $setting->value; // white
    }
}
```

### Typed Namespaced Settings

[](#typed-namespaced-settings)

For better DX, define custom typed settings classes:

#### Usage

[](#usage-1)

```
namespace App\Http\Controllers;

use App\Settings\HomeSettings;

class UserController extends Controller
{
    public function index(HomeSettings $settings)
    {
        $settings->color; // white

        $settings->color = 'black';
        $settings->save();
    }
}
```

#### Defining a Typed Settings Class

[](#defining-a-typed-settings-class)

```
namespace App\Settings;

use Elegantly\Settings\NamespacedSettings;

class HomeSettings extends NamespacedSettings
{
    public ?string $color = null;

    /** @var int[] */
    public array $articles = [];

    public static function getNamespace(): string
    {
        return 'home';
    }
}
```

---

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

---

Changelog
---------

[](#changelog)

See [CHANGELOG](CHANGELOG.md) for details on recent changes.

---

Contributing
------------

[](#contributing)

See [CONTRIBUTING](CONTRIBUTING.md) for contribution guidelines.

---

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review our [security policy](../../security/policy) for reporting vulnerabilities.

---

Credits
-------

[](#credits)

- [Quentin Gabriele](https://github.com/QuentinGab)
- [All Contributors](../../contributors)

---

License
-------

[](#license)

This package is open-sourced under the [MIT license](LICENSE.md).

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance82

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~169 days

Total

3

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d769563728757858e249f266ac2555f28db5640124df92821ed17d93ee76fc7b?d=identicon)[QuentinGab](/maintainers/QuentinGab)

---

Top Contributors

[![QuentinGab](https://avatars.githubusercontent.com/u/40128136?v=4)](https://github.com/QuentinGab "QuentinGab (26 commits)")

---

Tags

laravellaravel-packagesettingslaravellaravel-settingsElegantly

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/elegantly-laravel-settings/health.svg)

```
[![Health](https://phpackages.com/badges/elegantly-laravel-settings/health.svg)](https://phpackages.com/packages/elegantly-laravel-settings)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M46](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)[finller/laravel-media

A flexible media library for Laravel

472.1k](/packages/finller-laravel-media)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
