PHPackages                             jobmetric/laravel-setting - 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. jobmetric/laravel-setting

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

jobmetric/laravel-setting
=========================

This is a package for a dynamic setting across different Laravel projects.

2.0.0(3mo ago)653[4 PRs](https://github.com/jobmetric/laravel-setting/pulls)MITPHP &gt;=8.0.1

Since Dec 22Compare

[ Source](https://github.com/jobmetric/laravel-setting)[ Packagist](https://packagist.org/packages/jobmetric/laravel-setting)[ Docs](https://doc.jobmetric.net/package/laravel-setting)[ GitHub Sponsors](https://github.com/sponsors/majidmohammadian)[ RSS](/packages/jobmetric-laravel-setting/feed)WikiDiscussions Synced yesterday

READMEChangelog (2)Dependencies (9)Versions (9)Used By (0)

[![Contributors](https://camo.githubusercontent.com/14767c844d0df887a8c597eeaaccf8209c8675fc7dbadb317f89189797873003/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f6a6f626d65747269632f6c61726176656c2d73657474696e672e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-setting/graphs/contributors)[![Forks](https://camo.githubusercontent.com/2c347aa40fe22ba19f1e9d7a7d5d1dfefc917a7b16d090f3b4047e78d96ff730/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6a6f626d65747269632f6c61726176656c2d73657474696e672e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d466f726b)](https://github.com/jobmetric/laravel-setting/network/members)[![Stargazers](https://camo.githubusercontent.com/8c551c7dcd35378250bcd6e101b1160cd8277bbbc5cd01b837b251981f7b726b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6a6f626d65747269632f6c61726176656c2d73657474696e672e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-setting/stargazers)[![MIT License](https://camo.githubusercontent.com/80b11142c8063ce7bb18339307e67a5d1d06cbe5f2948aee75ba0a197eb99e81/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a6f626d65747269632f6c61726176656c2d73657474696e672e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-setting/blob/master/LICENCE.md)[![LinkedIn](https://camo.githubusercontent.com/eb590f47a3fca74584d18db8dd3e985ae3d786f50cd41b7530c3af3885da233c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4c696e6b6564496e2d626c75652e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6c696e6b6564696e26636f6c6f72423d353535)](https://linkedin.com/in/majidmohammadian)

Laravel Setting
===============

[](#laravel-setting)

**Build Dynamic Settings. Manage Them Safely.**

Laravel Setting lets you define application settings as form-driven classes and store/retrieve them from a database-backed cache. Stop scattering config values across controllers and configs. Use a unified settings layer with validation, caching, discovery, and clear storage keys.

Why Laravel Setting?
--------------------

[](#why-laravel-setting)

### Form-Driven Settings

[](#form-driven-settings)

Define each setting form by extending `JobMetric\Setting\Contracts\AbstractSetting` and returning a `JobMetric\Form\FormBuilder` that describes fields.

### Application-Key Storage

[](#application-key-storage)

Each setting form produces a stable `formName()` (`application_key`). Values are stored per field under that form.

### Fast Reads with Cache

[](#fast-reads-with-cache)

Reads are cached under `config('setting.cache_key')` (default: `SETTING`). Cache is invalidated whenever settings are stored or forgotten.

### Events and Lifecycle Control

[](#events-and-lifecycle-control)

Optionally fire `StoreSettingEvent` and `ForgetSettingEvent` when storing or deleting settings.

### Namespaced Discovery

[](#namespaced-discovery)

Register one or more namespaces in `SettingNamespaceRegistry`. `SettingRegistry` can discover and validate all `AbstractSetting` subclasses inside them.

What is a Setting Form?
-----------------------

[](#what-is-a-setting-form)

A setting form is a class that extends `AbstractSetting` and implements:

- `application()`
- `key()`
- `title()`
- `description()`
- `form()` (returns `FormBuilder`)

From these, `formName()` is built as `application() . '_' . key()` and used as the main storage identifier (`form` column in the `settings` table).

What Awaits You?
----------------

[](#what-awaits-you)

By adopting Laravel Setting, you can:

- Create setting form classes with `setting:make`
- Store values safely with `Setting::dispatch()` (class-based) or `Setting::dispatchByForm()` (raw)
- Retrieve values with `Setting::get()`, `Setting::form()` and class helpers like `Setting::getFromClass()`
- Invalidate cache via `setting:clear`
- Discover all setting forms through `SettingNamespaceRegistry` and `SettingRegistry`
- Listen to store/forget events with optional dispatching control

Quick Start
-----------

[](#quick-start)

Install Laravel Setting via Composer:

```
composer require jobmetric/laravel-setting
```

Run migrations:

```
php artisan migrate
```

Create a setting form class:

```
php artisan setting:make ConfigSetting --application=app --title="Config" --description="Application configuration"
```

Edit the generated class and implement `form()` by adding the desired fields using `FormBuilder`.

Usage
-----

[](#usage)

### Store settings by form name (raw)

[](#store-settings-by-form-name-raw)

Use `dispatchByForm()` (or the `dispatchSetting()` helper). Keys in the object must start with the `form` prefix (`{application_key}_...`).

```
use JobMetric\Setting\Facades\Setting;

Setting::dispatchByForm('app_config', [
    'app_config_site_name' => 'My Site',
    'app_config_site_url'  => 'https://example.com',
]);
```

Or via helper:

```
dispatchSetting('app_config', [
    'app_config_site_name' => 'My Site',
]);
```

### Store settings by setting class (validated)

[](#store-settings-by-setting-class-validated)

Use `dispatch()` (or `dispatchSettingFromClass()`) for class-based dispatch with DTO validation via `FormBuilderRequest`.

```
use JobMetric\Setting\Facades\Setting;
use App\Settings\ConfigSetting;

Setting::dispatch(ConfigSetting::class, [
    'site_name' => 'My Site',
]);
```

### Read settings

[](#read-settings)

```
use JobMetric\Setting\Facades\Setting;

$siteName = Setting::get('app_config_site_name');
$form = Setting::form('app_config');
```

### Read from a setting class

[](#read-from-a-setting-class)

```
use JobMetric\Setting\Facades\Setting;
use App\Settings\ConfigSetting;

$siteName = Setting::getFromClass(ConfigSetting::class, 'site_name');
$form = Setting::getFromClass(ConfigSetting::class, null);
```

### Forget settings (delete + cache invalidation)

[](#forget-settings-delete--cache-invalidation)

```
use JobMetric\Setting\Facades\Setting;

Setting::forget('app_config');
```

### Clear cache

[](#clear-cache)

```
php artisan setting:clear
```

Documentation
-------------

[](#documentation)

Ready to transform your Laravel applications? Our comprehensive documentation is your gateway to mastering Laravel Setting:

**[📚 Read Full Documentation -&gt;](https://doc.jobmetric.net/package/laravel-setting)**

The documentation includes:

- **Getting Started** - installation and migration steps
- **Setting Forms** - `AbstractSetting`, `formName()`, and `FormBuilder`
- **Setting Service** - storing, forgetting, cache invalidation, and retrieval APIs
- **Registries** - `SettingNamespaceRegistry` and `SettingRegistry` discovery rules
- **Commands** - `setting:make`, `setting:clear`
- **Events** - `StoreSettingEvent` and `ForgetSettingEvent`
- **Helpers** - `dispatchSetting`, `dispatchSettingFromClass`, and read/exists utilities
- **Testing** - package tests and common verification flows

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

[](#contributing)

Thank you for participating in `laravel-setting`. A contribution guide can be found [here](CONTRIBUTING.md).

License
-------

[](#license)

The `laravel-setting` is open-sourced software licensed under the MIT license. See [License File](LICENCE.md) for more information.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance80

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93% 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 ~117 days

Total

8

Last Release

106d ago

Major Versions

1.3.0 → 2.0.02026-03-19

### Community

Maintainers

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

---

Top Contributors

[![MajidMohammadian](https://avatars.githubusercontent.com/u/2099965?v=4)](https://github.com/MajidMohammadian "MajidMohammadian (53 commits)")[![Bagheri-Matin](https://avatars.githubusercontent.com/u/239607447?v=4)](https://github.com/Bagheri-Matin "Bagheri-Matin (4 commits)")

---

Tags

laravelconfigpackagesettingjobmetric

### Embed Badge

![Health badge](/badges/jobmetric-laravel-setting/health.svg)

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

###  Alternatives

[creasi/laravel-nusa

A Laravel package that aim to provide Indonesia' Administrative Data

997.9k2](/packages/creasi-laravel-nusa)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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