PHPackages                             mr-luke/settings-manager - 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. mr-luke/settings-manager

ActiveLibrary

mr-luke/settings-manager
========================

Laravel 5 Package that provides settings manager with type casting.

2.0.0(3y ago)332.7k↓50%1[4 PRs](https://github.com/mr-luke/settings-manager/pulls)MITPHPPHP ^8.1

Since Oct 26Pushed 1y ago2 watchersCompare

[ Source](https://github.com/mr-luke/settings-manager)[ Packagist](https://packagist.org/packages/mr-luke/settings-manager)[ RSS](/packages/mr-luke-settings-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (6)Versions (14)Used By (0)

Settings Manager - Laravel multibag settings Package.
=====================================================

[](#settings-manager---laravel-multibag-settings-package)

[![Latest Stable Version](https://camo.githubusercontent.com/483ed4e41888ce2855c8eab45174acc03e8a4514eeaa09b62aede67647a7567a/68747470733a2f2f706f7365722e707567782e6f72672f6d722d6c756b652f73657474696e67732d6d616e616765722f762f737461626c65)](https://packagist.org/packages/mr-luke/settings-manager)[![Total Downloads](https://camo.githubusercontent.com/8b9ba0ff6b6b4e9c5df8d9f752fa5950b28382dd1774888e023a945a6a1b1aa5/68747470733a2f2f706f7365722e707567782e6f72672f6d722d6c756b652f73657474696e67732d6d616e616765722f646f776e6c6f616473)](https://packagist.org/packages/mr-luke/settings-manager)[![License](https://camo.githubusercontent.com/6ff8b7ace311448c81dff54e9e091b41d175df65763e1519d7ac8912ca5b9edd/68747470733a2f2f706f7365722e707567782e6f72672f6d722d6c756b652f73657474696e67732d6d616e616765722f6c6963656e7365)](https://packagist.org/packages/mr-luke/settings-manager)

[![Tests Workflow](https://github.com/mr-luke/settings-manager/actions/workflows/run-testsuit.yaml/badge.svg)](https://github.com/mr-luke/settings-manager/actions/workflows/run-testsuit.yaml/badge.svg)[![Quality Gate Status](https://camo.githubusercontent.com/dcfe0153866eafe60812f67a60d241e55ef1073b5cda3db3597d7cd08a534228/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6d722d6c756b655f73657474696e67732d6d616e61676572266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=mr-luke_settings-manager)[![Security Rating](https://camo.githubusercontent.com/b9f1b0be6cd2a72bee31eb27fd072ef438f30c2498e40b8d0668ec2e377b8883/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6d722d6c756b655f73657474696e67732d6d616e61676572266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=mr-luke_settings-manager)[![Reliability Rating](https://camo.githubusercontent.com/fed12bed12cf521f9532314970566c5ddf877bd0115dd8b4d2e24bea171fdb97/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6d722d6c756b655f73657474696e67732d6d616e61676572266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=mr-luke_settings-manager)

This package provides settings manamgement to your Laravel app with support of multiple setting bags with typed value.

- [Getting Started](#getting-started)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Plans](#plans)

Getting Started
---------------

[](#getting-started)

Setting Manager supported versions:

- Laravel 10
- Laravel 9
- Laravel 8

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

[](#installation)

To install through composer, simply put the following in your composer.json file and run `composer update`

```
{
    "require": {
        "mr-luke/settings-manager": "~2.0"
    }
}
```

Or use the following command

```
composer require "mr-luke/settings-manager"
```

Next, add the service provider to `app/config/app.php`

```
Mrluke\Settings\SettingsServiceProvider::class,

```

*Note: Package is auto-discoverable!*

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

[](#configuration)

To use `SettingsManager` you need to setup your `Bags` first. Add your own one to the [config file](config/settings-manager.php) `bags`:

```
'bags' => [
    'general' => [ // Given key is used as a Bag name
        'driver'   => 'database', // One of available drivers
        'cache'    => true, // Should be Cached
        'lifetime' => 60 // Cache lifetime in minutes
	],
],
```

You can setup different database connections or tables by new `driver` or different `json` files in:

```
'drivers' => [
    'database' => [
        'class'      => \Mrluke\Settings\Drivers\Database::class,
        'connection' => 'mysql',
        'table'      => 'settings',
    ],

    'json' => [
        'class' => \Mrluke\Settings\Drivers\Json::class,
        'path'  => base_path('storage/app/settings/'),
        'file'  => 'settings.json',
    ]
],
```

You can also publish config file via command:

```
php artisan vendor:publish
```

Usage
-----

[](#usage)

### Facade

[](#facade)

You can access to `Manager` and your `Bags` using `Mrluke\Settings\Facades\Settings`.

### Type

[](#type)

`SettingsManager` is a type casted tool that care about it during the whole process.

Example: *You can pass `string 5.567` to `set` method for `ratio` setting (`float`) and `SettingsManager` will cast the value to `float 5.567` behind the scean.*

Whereever you ask for certain key, it will always be correct type. But all begins at the point of `registering`...

### Registering new index

[](#registering-new-index)

To register new value use:

```
$value = Settings::register(string $key, $value, string $type);
```

This method returns given `$value` casted to given `$type`.

### Accessing index

[](#accessing-index)

To get value use:

```
$value = Settings::get(string $key, $default = null);
```

This method returns `$default` in case given `$key` is not present in the `Bag`. Otherwise `$value` is casted to registered `type`.

### Setting new value of index

[](#setting-new-value-of-index)

To set new value use:

```
$value = Settings::set(string $key, $value);
```

This method returns `$value` casted to registered `type`. If given `$key` is not present, it will automaticaly call `register` method with auto-detected `type`.

*This method shoud not be use to register settings in general! Use `Eventing` to detect all needed settings during development.*

### Forgeting an index

[](#forgeting--an-index)

To forget an index use:

```
Settings::forget(string $key);
```

### Default `Bag` vs specified

[](#default-bag-vs-specified)

To access specific `Bag` use bag accessor method:

```
$value = Settings::bag(string $name)->get(string $key, $default = null);
```

### Helper

[](#helper)

You can access to `SettingsManager` via helper function:

```
// Get index
settings(string $key);
// Set value
settings([string $key => $value]);
// Get instance and perform action
settings()->forget(string $key);
```

### Events

[](#events)

`SettingsManager` provides you a list of `pre` and `post` action events to help you handle different situations.

Example: *You can use `Mrluke\Settings\Events\Registered` event to prepare full list of production settings.*

Namespace `Mrluke\Settings\Events`:

- `Forgeting`
- `Forgot`
- `Loading`
- `Loaded`
- `Registering`
- `Registered`
- `Updating`
- `Updated`

### JSON Structure

[](#json-structure)

`SettingsManager` provides JSON Driver for configurations that can be share with front-end apps. The structure looks like this:

```
{
  "key": {
    "type": "",
    "value": ""
  },
  "another": {
    "type": "",
    "value": ""
  }
}
```

Plans
-----

[](#plans)

- Artisan Commands
- Blade helpers for `bool` keys
- Additional option to store `default` value from `get()` method

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 90.5% 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 ~207 days

Recently: every ~327 days

Total

9

Last Release

1104d ago

Major Versions

v1.2.5 → 2.0.02023-05-10

PHP version history (4 changes)v1.0.0PHP &gt;=7.0

v1.0.1PHP &gt;=7.1

v1.2.5PHP &gt;=7.2.5

2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6df8e77a6f4e11408a5658f9127c96ba429354d6ba71a9a5b43966e19455ed17?d=identicon)[mr-luke](/maintainers/mr-luke)

---

Top Contributors

[![mr-luke](https://avatars.githubusercontent.com/u/12121875?v=4)](https://github.com/mr-luke "mr-luke (38 commits)")[![hsmusz](https://avatars.githubusercontent.com/u/4090847?v=4)](https://github.com/hsmusz "hsmusz (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

castdatabsejsonlaravellaravel5laravel6laravel7settingssettings-managementlaravelSettingsmanager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mr-luke-settings-manager/health.svg)

```
[![Health](https://phpackages.com/badges/mr-luke-settings-manager/health.svg)](https://phpackages.com/packages/mr-luke-settings-manager)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[akaunting/laravel-setting

Persistent settings package for Laravel

495805.1k7](/packages/akaunting-laravel-setting)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[optimistdigital/nova-locale-manager

Laravel Nova tool to manage locales.

167.0k](/packages/optimistdigital-nova-locale-manager)

PHPackages © 2026

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