PHPackages                             cloudcake/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. cloudcake/laravel-settings

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

cloudcake/laravel-settings
==========================

Associate generic data to any other model without polluting your application model logic.

v1.2(6y ago)0116MITPHPCI failing

Since Sep 13Pushed 6y agoCompare

[ Source](https://github.com/cloudcake/laravel-settings)[ Packagist](https://packagist.org/packages/cloudcake/laravel-settings)[ RSS](/packages/cloudcake-laravel-settings/feed)WikiDiscussions master Synced 6d ago

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

Settings
========

[](#settings)

**Settings** is a package to assist in associating settings or attributes of JSON form to any of your models using polymorphic relationships.

Usage
=====

[](#usage)

Publish Migrations
------------------

[](#publish-migrations)

```
php artisan vendor:publish --provider="Settings\Providers\SettingsServiceProvider" \
                           --tag="migrations"
```

Setup models with settings
--------------------------

[](#setup-models-with-settings)

Add the `\Settings\Traits\HasSettings` trait to any model that should have settings.

```
use Settings\Traits\HasSettings;

class User extends Model
{
    use HasSettings;
}
```

Creating Settings
-----------------

[](#creating-settings)

#### Global Settings

[](#global-settings)

```
use Settings\Models\Setting;

Setting::make('config', [
  'rateLimit' => true,
  'ipLocks'   => [
    '127.0.0.1',
    '10.0.0.1'
  ]
]);
```

#### Model Specific Settings

[](#model-specific-settings)

```
use Settings\Models\Setting;

Setting::make('preferences', [
  'notifications'    => true,
  'backgroundColour' => '#ffffff'
], \App\User::class);
```

Attaching Settings
------------------

[](#attaching-settings)

When attaching settings, any fields not provided will receive the default values.

```
\App\User::find(1)->attachSetting('preferences', [
  'notifications' => false,
]);
```

The above will set `notifications` to `true` while `backgroundColour` will be inherited from the original setting. If the global setting is changed, the user's setting will return the changed setting.

Getting Settings
----------------

[](#getting-settings)

#### Get All Fields

[](#get-all-fields)

```
\App\User::first()->setting('preferences');
```

#### Get Specific Field

[](#get-specific-field)

```
\App\User::first()->setting('preferences')->get('notifications');
```

Modifying Settings
------------------

[](#modifying-settings)

```
\App\User::first()->setting('preferences')->set('notifications', true);
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

2316d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1300442?v=4)[Stephen Lake](/maintainers/stephenlake)[@stephenlake](https://github.com/stephenlake)

---

Top Contributors

[![stephenlake](https://avatars.githubusercontent.com/u/1300442?v=4)](https://github.com/stephenlake "stephenlake (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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