PHPackages                             hasan-ahani/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. [Database &amp; ORM](/categories/database)
4. /
5. hasan-ahani/settings

ActiveLibrary[Database &amp; ORM](/categories/database)

hasan-ahani/settings
====================

Application wide settings stored in your database

v2.3(5mo ago)00MITPHPPHP ^8.2

Since Nov 21Pushed 5mo agoCompare

[ Source](https://github.com/hasan-ahani/settings)[ Packagist](https://packagist.org/packages/hasan-ahani/settings)[ Docs](https://github.com/outer-web/settings)[ GitHub Sponsors](https://github.com/Outerweb)[ RSS](/packages/hasan-ahani-settings/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (14)Versions (2)Used By (0)

[![Settings](./docs/images/github-banner.png)](./docs/images/github-banner.png)

Settings
========

[](#settings)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a817c08a2af9a8d7682d87fc4d4329c1bab1b5473a04ce455e3deda699b88146/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f757465727765622f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/outerweb/settings)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d986059bdb2e1ac23d6e49d0fe358201b39c418ea4e30de93c200c4d6a9f6d88/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f757465727765622f73657474696e67732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/outer-web/settings/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/979c2e5834059a80419a774a8441b903f84145d9ed0eb9adf5232074d6c13e20/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f757465727765622f73657474696e67732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/outer-web/settings/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/64a6ff09f89384acc3487b3830a6bc71bf11ad29370bdbd59da0e1c89971b88a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f757465727765622f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/outerweb/settings)

This package provides application wide settings stored in your database

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Changelog](#changelog)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require outerweb/settings
```

Run the install command to publish the migration and the config file:

```
php artisan settings:install
```

Usage
-----

[](#usage)

This package tries to mimic the Config functionality of Laravel as close as possible.

You can use the `Outerweb\Settings\Facades\Setting` facade or the `setting()` helper function to work with your stored settings.

### Storing settings

[](#storing-settings)

#### Storing a single setting

[](#storing-a-single-setting)

```
use Outerweb\Settings\Facades\Setting;

Setting::set('key', 'value');
// or
setting(['key' => 'value']);
// or
setting()->set('key', 'value');
```

#### Storing multiple settings

[](#storing-multiple-settings)

```
use Outerweb\Settings\Facades\Setting;

Setting::set([
    'key1' => 'value1',
    'key2' => 'value2',
]);
// or
setting([
    'key1' => 'value1',
    'key2' => 'value2',
]);
// or
setting()->set([
    'key1' => 'value1',
    'key2' => 'value2',
]);
```

#### Storing nested settings

[](#storing-nested-settings)

You can use "dot" notation to store nested settings:

```
use Outerweb\Settings\Facades\Setting;

Setting::set('parent.child', 'value');
// or
setting(['parent.child' => 'value']);
// or
setting()->set('parent.child', 'value');
```

This will store a single table entry with the key `parent.child` and the value `value`.

You can also store nested settings using arrays:

```
use Outerweb\Settings\Facades\Setting;

Setting::set([
    'parent' => [
        'child1' => 'value',
        'child2' => 'value',
    ],
]);
// or
setting([
    'parent' => [
        'child1' => 'value',
        'child2' => 'value',
    ],
]);
// or
setting()->set([
    'parent' => [
        'child1' => 'value',
        'child2' => 'value',
    ],
]);
```

This will store two table entries:

- `parent.child1` with the value `value`
- `parent.child2` with the value `value`

### Retrieving settings

[](#retrieving-settings)

#### Retrieving a single setting

[](#retrieving-a-single-setting)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::get('key');
// or
$value = setting('key');
// or
$value = setting()->get('key');
```

This will return the value of the setting stored with the key `key`. If the setting does not exist, it will return `null`.

You can also provide a default value that will be returned if the setting does not exist:

```
$value = Setting::get('key', 'default_value');
// or
$value = setting('key', 'default_value');
// or
$value = setting()->get('key', 'default_value');
```

This will return `default_value` if the setting with the key `key` is null or does not exist.

#### Retrieving a nested setting

[](#retrieving-a-nested-setting)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::get('parent.child');
// or
$value = setting('parent.child');
// or
$value = setting()->get('parent.child');
```

This will return the value of the setting stored with the key `parent.child`.

#### Retrieving multiple settings via parent key

[](#retrieving-multiple-settings-via-parent-key)

Imagine you have the following settings stored:

- `parent.child1` with the value `value1`
- `parent.child2` with the value `value2`

```
use Outerweb\Settings\Facades\Setting;

$values = Setting::get('parent');
// or
$values = setting('parent');
// or
$values = setting()->get('parent');
```

This will return an associative array:

```
[
    'child1' => 'value1',
    'child2' => 'value2',
]
```

#### Retrieving multiple settings

[](#retrieving-multiple-settings)

```
use Outerweb\Settings\Facades\Setting;

$values = Setting::get(['parent.child1', 'parent.child2']);
// or
$values = setting(['parent.child1', 'parent.child2']);
// or
$values = setting()->get(['parent.child1', 'parent.child2']);
```

This will return an associative array:

```
[
    'parent.child1' => 'value1',
    'parent.child2' => 'value2',
]
```

#### Retrieving all settings

[](#retrieving-all-settings)

```
use Outerweb\Settings\Facades\Setting;

$values = Setting::get();
// or
$values = setting()->get();
```

This will return all settings as an associative array.

### Type safety

[](#type-safety)

You can use the following methods to ensure type safety when retrieving settings:

#### String

[](#string)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::string('key');
// or
$value = setting()->string('key');
```

This will make sure the returned value is a string. Otherwise, it will throw an `UnexpectedValueException`.

#### Integer

[](#integer)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::integer('key');
// or
$value = setting()->integer('key');
```

This will make sure the returned value is an integer. Otherwise, it will throw an `UnexpectedValueException`.

#### Float

[](#float)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::float('key');
// or
$value = setting()->float('key');
```

This will make sure the returned value is a float. Otherwise, it will throw an `UnexpectedValueException`.

#### Boolean

[](#boolean)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::boolean('key');
// or
$value = setting()->boolean('key');
```

This will make sure the returned value is a boolean. Otherwise, it will throw an `UnexpectedValueException`.

#### Array

[](#array)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::array('key');
// or
$value = setting()->array('key');
```

This will make sure the returned value is an array. Otherwise, it will throw an `UnexpectedValueException`.

#### Collection

[](#collection)

```
use Outerweb\Settings\Facades\Setting;

$value = Setting::collection('key');
// or
$value = setting()->collection('key');
```

This uses the same logic as `array()` but returns a `Illuminate\Support\Collection` instance instead of an array.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance70

Regular maintenance activity

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

Unknown

Total

1

Last Release

178d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45d5f922a825178e4231a3ca5d91b123721e3847a95923b130ac78157c409397?d=identicon)[hasan-ahani](/maintainers/hasan-ahani)

---

Top Contributors

[![hasan-ahani](https://avatars.githubusercontent.com/u/67734902?v=4)](https://github.com/hasan-ahani "hasan-ahani (2 commits)")[![SimonBroekaert](https://avatars.githubusercontent.com/u/35606498?v=4)](https://github.com/SimonBroekaert "SimonBroekaert (2 commits)")

---

Tags

laravelSettingsOuterweb

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/hasan-ahani-settings/health.svg)

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

###  Alternatives

[outerweb/settings

Application wide settings stored in your database

4899.2k5](/packages/outerweb-settings)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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