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

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

vkovic/laravel-settings
=======================

Easy way to save and retrieve app specific setting

v0.2.0(7y ago)772MITPHPPHP ^7.0

Since Dec 17Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (3)Used By (0)

Laravel Settings
================

[](#laravel-settings)

[![Build](https://camo.githubusercontent.com/5ee1f4dc19efdb2ca8364cf99d001304bc3779a583e00ab378c457c88f0c4cc5/68747470733a2f2f6170692e7472617669732d63692e6f72672f766b6f7669632f6c61726176656c2d73657474696e67732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vkovic/laravel-settings)[![Downloads](https://camo.githubusercontent.com/bd1e55467baf622185ef79b72a425646d7963e829c9ee18647b7f6766dea0cb3/68747470733a2f2f706f7365722e707567782e6f72672f766b6f7669632f6c61726176656c2d73657474696e67732f646f776e6c6f616473)](https://packagist.org/packages/vkovic/laravel-settings)[![Stable](https://camo.githubusercontent.com/915a0f8d73ab4d86f70eedba051209a984b16f80958815743bc47c7e76c01628/68747470733a2f2f706f7365722e707567782e6f72672f766b6f7669632f6c61726176656c2d73657474696e67732f762f737461626c65)](https://packagist.org/packages/vkovic/laravel-settings)[![License](https://camo.githubusercontent.com/e0dfeb18553602604e43f4dc90e66e83749d33178c17605288bfc38e2b4afaa8/68747470733a2f2f706f7365722e707567782e6f72672f766b6f7669632f6c61726176656c2d73657474696e67732f6c6963656e7365)](https://packagist.org/packages/vkovic/laravel-settings)

### Persist application settings in database easily

[](#persist-application-settings-in-database-easily)

If you want to save application specific settings and you don't want to create another table/model/logic, this package is for you.

---

Compatibility
-------------

[](#compatibility)

The package is compatible with Laravel versions `>= 5.5`

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

[](#installation)

Install the package via composer:

```
composer require vkovic/laravel-settings
```

Run migrations to create table which will be used to store our settings:

```
php artisan migrate
```

Usage
-----

[](#usage)

Let's create and retrieve some settings:

```
// Set setting value as string
Settings::set('foo', 'bar');

// Get setting value
Settings::get('foo'); // : 'bar'

// In case there is no settings found for given key,
// we can pass default value to return
Settings::get('baz', 'default'); // : 'default'
```

Multiple records could be retrieved using `query` method and wildcard `*`:

```
Settings::set('computer.display.resolution', '1280x1024');
Settings::set('computer.display.brightness', 97);
Settings::set('computer.sound.volume', 54);
Settings::set('computer.mic.volume', 0);

Settings::query('computer.display.*');
// Result:
// [
//     'computer.display.resolution' => '1280x1024',
//     'computer.display.brightness' => 97
// ]

Settings::query('*.sound.*');
// Result:
// [
//     'computer.sound.volume' => 54
// ]

Settings::query('computer.*.volume');
// Result:
// [
//     'computer.sound.volume' => 54,
//     'computer.mic.volume' => 0
// ]

// In case there is no settings found for given query,
// we can pass default value to return
Settings::query('computer.sound.bass', 85); // : 85
```

Beside string, settings can also be stored as integer, float, null, boolean or array:

```
Settings::set('age', 35);
Settings::set('temperature', 24.7);
Settings::set('value', null);
Settings::set('employed', true);
Settings::set('fruits', ['orange', 'apple']);

Settings::get('age'); // : 35
Settings::get('temperature'); // : 24.7
Settings::get('value', null); // : null
Settings::get('employed'); // : true
Settings::get('fruits'); // : ['orange', 'apple']
```

We can easily check if settings exists without actually retrieving it from our table:

```
Settings::set('foo', 'bar');

Settings::exists('foo'); // : true
```

Counting all settings records is also a breeze:

```
Settings::set('a', 'one');
Settings::set('b', 'two');

Settings::count(); // : 2
```

If we need all settings, or just keys, no problem:

```
Settings::set('a', 'one');
Settings::set('b', 'two');
Settings::set('c', 'three');

// Get all settings
Settings::all(); // : ['a' => 'one', 'b' => 'two', 'c' => 'three']

// Get only keys
Settings::keys(); // : [0 => 'a', 1 => 'b', 2 => 'c']
```

Also, we can remove settings easily:

```
Settings::set('a', 'one');
Settings::set('b', 'two');
Settings::set('c', 'three');

// Remove settings by key
Settings::remove('a');

// Or array of keys
Settings::remove(['b', 'c']);
```

If, for some reason, we want to delete all settings at once, no problem:

```
// This will delete all settings!
Settings::purge();
```

---

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

[](#contributing)

If you plan to modify this Laravel package you should run tests that comes with it. Easiest way to accomplish this would be with `Docker`, `docker-compose` and `phpunit`.

First, we need to initialize Docker containers:

```
docker-compose up -d
```

After that, we can run tests and watch the output:

```
docker-compose exec app vendor/bin/phpunit
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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

Total

2

Last Release

2679d ago

### Community

Maintainers

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

---

Top Contributors

[![vkovic](https://avatars.githubusercontent.com/u/4613605?v=4)](https://github.com/vkovic "vkovic (11 commits)")

---

Tags

laravelSettings

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[akaunting/laravel-setting

Persistent settings package for Laravel

495805.1k7](/packages/akaunting-laravel-setting)

PHPackages © 2026

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