PHPackages                             danielemontecchi/laravel-scoped-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. [Caching](/categories/caching)
4. /
5. danielemontecchi/laravel-scoped-settings

ActiveLibrary[Caching](/categories/caching)

danielemontecchi/laravel-scoped-settings
========================================

Manage global and model-scoped settings in Laravel with a clean API, artisan commands, and optional per-scope caching.

v1.2.0(1mo ago)09MITPHPPHP ^8.3CI passing

Since Apr 16Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/danielemontecchi/laravel-scoped-settings)[ Packagist](https://packagist.org/packages/danielemontecchi/laravel-scoped-settings)[ Docs](https://danielemontecchi.com)[ RSS](/packages/danielemontecchi-laravel-scoped-settings/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (9)Versions (12)Used By (0)

Laravel Scoped Settings
=======================

[](#laravel-scoped-settings)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fcab094f8c9cc06e58289ff31a28428bc3e76314c37c9c45752bd591935be989/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e69656c656d6f6e7465636368692f6c61726176656c2d73636f7065642d73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danielemontecchi/laravel-scoped-settings)[![Total Downloads](https://camo.githubusercontent.com/cf8b78e70cbc8b078422fd2b37c1321b4596efc08adfe567160a3f20820387d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e69656c656d6f6e7465636368692f6c61726176656c2d73636f7065642d73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/danielemontecchi/laravel-scoped-settings)[![GitHub Tests Action Status](https://camo.githubusercontent.com/27f715e60b65141fbc74717ed05175456c7d42e4ac05fd10e3dbbb9389569dd6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64616e69656c656d6f6e7465636368692f6c61726176656c2d73636f7065642d73657474696e67732f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/danielemontecchi/laravel-scoped-settings/actions/workflows/tests.yml)[![Quality Gate Status](https://camo.githubusercontent.com/97a12552e4e9cf62f2b90f1f59e38009ff14cfff59aa04e52ddf3b611aab2b59/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d64616e69656c656d6f6e7465636368695f6c61726176656c2d73636f7065642d73657474696e6773266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=danielemontecchi_laravel-scoped-settings)[![Maintainability Rating](https://camo.githubusercontent.com/44a68efd437bed9310ae6f91ff1b263fc08746950c651cca89bc39ba05b611a4/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d64616e69656c656d6f6e7465636368695f6c61726176656c2d73636f7065642d73657474696e6773266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/summary/new_code?id=danielemontecchi_laravel-scoped-settings)[![License: MIT](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Documentation](https://camo.githubusercontent.com/09e816ae34b01c0a0c356178a99f4041e3c82696002ef2dd521eb5b0f16c6ace/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d617661696c61626c652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://danielemontecchi.github.io/laravel-scoped-settings)

---

**Laravel Scoped Settings** is a lightweight Laravel package that provides a simple and elegant way to manage global and model-scoped application settings.

- ⚡ Supports **global settings** and **per-model scoped settings**
- 🎯 API via Facade and `setting()` helper
- ✅ Includes artisan commands and full test suite
- 🚀 Optional **per-scope caching** built into `set()` and `get()`

---

📦 Installation
--------------

[](#-installation)

You can install the package via Composer:

```
composer require danielemontecchi/laravel-scoped-settings
```

To customize default cache behavior, publish the config file:

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

To publish and run the migrations:

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

---

🛠 Usage
-------

[](#-usage)

```
// Global settings
setting()->set('site.name', 'My App');
$siteName = setting()->get('site.name');

// Set with optional caching (global or scoped)
setting()->set('site.name', 'My App', 3600); // Cache for 1 hour

// If TTL is omitted, uses default from config (or disables cache)
setting()->set('site.name', 'My App'); // No cache if config is null

// Check if a setting exists (ignores fallback)
if (setting()->has('site.name')) {
    // the value is explicitly set
}

// Scoped settings (e.g. per user)
setting()->for($user)->set('dashboard.layout', 'compact');
$layout = setting()->for($user)->get('dashboard.layout');
```

You can also retrieve all flat or grouped settings:

```
setting()->all(); // ['site.name' => 'My App']
setting()->for($user)->group('dashboard'); // ['layout' => 'compact']
```

Clear a specific key:

```
setting()->forget('site.name');
```

---

🛠 Artisan Commands
------------------

[](#-artisan-commands)

```
php artisan settings:list     # Show all settings in CLI
php artisan settings:clear    # Clear all settings
php artisan settings:export   # Export settings to JSON
php artisan settings:import   # Import settings from JSON
```

---

🧪 Testing
---------

[](#-testing)

```
./vendor/bin/pest
```

Coverage reports are generated via `phpunit.xml` config and uploaded to [Codecov](https://codecov.io/).

---

📚 Documentation
---------------

[](#-documentation)

Full documentation available at:

👉

Includes:

- Installation &amp; Configuration
- Usage Examples
- Scoping Strategies
- Artisan Commands
- Advanced Tips

---

License
-------

[](#license)

Laravel Scoped Settings is open-source software licensed under the **MIT license**. See the [LICENSE.md](LICENSE.md) file for full details.

---

Made with ❤️ by [Daniele Montecchi](https://danielemontecchi.com)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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 ~34 days

Recently: every ~81 days

Total

11

Last Release

46d ago

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.1.3PHP ^8.1 || ^8.2 || ^8.3 || ^8.4

v1.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/8893e23896e96d0984bc8803307baa52fd63e7e2c08c4048d90a95023f134864?d=identicon)[danielemontecchi](/maintainers/danielemontecchi)

---

Top Contributors

[![danielemontecchi](https://avatars.githubusercontent.com/u/2247871?v=4)](https://github.com/danielemontecchi "danielemontecchi (24 commits)")

---

Tags

artisancachingconfigurationglobal-settingslaravellaravel-packagemodel-settingsphpscopedsettingslaravelconfigurationSettingscachingmodel settingsglobal settingsscoped

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[nexxai/laravel-cfcache

A handful of Cloudflare cache helpers for Laravel

1317.7k](/packages/nexxai-laravel-cfcache)[swiggles/memcache

Memcache driver for Laravel 5

1449.9k1](/packages/swiggles-memcache)

PHPackages © 2026

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