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

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

elipzis/laravel-simple-setting
==============================

Simple key/value typed settings for your Laravel app

v1.3.0(2y ago)106231[4 PRs](https://github.com/elipZis/laravel-simple-setting/pulls)1MITPHPPHP ^8.2CI passing

Since Dec 25Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/elipZis/laravel-simple-setting)[ Packagist](https://packagist.org/packages/elipzis/laravel-simple-setting)[ Docs](https://github.com/elipzis/laravel-simple-setting)[ GitHub Sponsors](https://github.com/elipZis)[ RSS](/packages/elipzis-laravel-simple-setting/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (13)Versions (9)Used By (1)

Simple key/value typed settings for your Laravel app
====================================================

[](#simple-keyvalue-typed-settings-for-your-laravel-app)

[![Latest Version on Packagist](https://camo.githubusercontent.com/03c9e0b2037a6aaad22a8231c26cff3119a43ebb7bed7cd57ec2c2850ec28fca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c69707a69732f6c61726176656c2d73696d706c652d73657474696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elipzis/laravel-simple-setting)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6f8f5f600e64b280ea52e398ce6dd1798cd8fd114d7628e59e38c9f4215acd13/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f656c69707a69732f6c61726176656c2d73696d706c652d73657474696e672f72756e2d74657374732e796d6c3f6272616e63683d6d61696e)](https://github.com/elipzis/laravel-simple-setting/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9e9bb253637dcb7a628277f47ee88b57e3744844e29df33067be2f18cd550f17/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f656c69707a69732f6c61726176656c2d73696d706c652d73657474696e672f7068702d63732d66697865722e796d6c3f6272616e63683d6d61696e)](https://github.com/elipzis/laravel-simple-setting/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b284b568e8faf71452e596abdc3d14f5e2223a030a7d31f9eaf761fe89875cf6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c69707a69732f6c61726176656c2d73696d706c652d73657474696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elipzis/laravel-simple-setting)

Create, store and use

- key/value settings,
- typed from numbers over dates to array,
- cached for quick access and
- automatically synchronized to a configured disc as a static json export.

Create any setting you like

```
Setting::create([
    'key'   => 'setting.example.int',
    'type'  => 'integer',
    'value' => 336,
]);
```

and get it back, anywhere in your app

```
$example = Setting::getValue('setting.example.int');
```

or access the statically created e.g. `settings.json` export to reduce Webserver load!

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

[](#installation)

You can install the package via composer:

```
composer require elipzis/laravel-simple-setting
```

You can publish the config file with:

```
php artisan vendor:publish --tag="simple-setting-config"
```

This is the contents of the published config file:

```
    return [
        'repository' => [
            //The table name where to store the settings.
            'table' => 'settings',
            //The used cache configuration
            'cache' => [
                'prefix' => 'settings',
                'ttl'    => 3600
            ]
        ],

        'routing' => [
            //Should routes be available to access the settings?
            'enabled'    => true,
            //What path prefix to be used
            'prefix'     => 'setting',
            //Any middleware?
            'middleware' => [],
        ],

        'sync' => [
            //Where to statically sync the settings to
            'disc'     => env('FILESYSTEM_DRIVER', 'local'),
            //The filename to write to
            'filename' => 'settings.json',
            //Whether to automatically (re-)sync the settings to the disc with every change
            'auto'     => true
        ]
    ];
```

Before you publish the migrations, publish the config, if you would like to alter e.g. the table name.

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="simple-setting-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### Creation

[](#creation)

The following types can be used:

```
Setting::create([
    'key'   => 'setting.example.int',
    'type'  => 'integer',
    'value' => 336,
]);
```

```
$now = Carbon::now();
Setting::create([
    'key'   => 'setting.example.datetime',
    'type'  => 'datetime', //or date
    'value' => $now->addWeeks(2),
]);
```

```
Setting::create([
    'key'   => 'setting.example.bool',
    'type'  => 'boolean',
    'value' => false
]);
```

```
Setting::create([
    'key'   => 'setting.example.array',
    'type'  => 'array',
    'value' => [
        'exampleA' => 'A',
        'exampleB' => 'B',
        'exampleC' => 'C',
    ]
]);
```

```
Setting::create([
    'key'   => 'setting.example.string',
    'type'  => 'string',
    'value' => '((x^0.5)/0.9)+10'
]);
```

### Retrieval

[](#retrieval)

Return the whole model

```
Setting::get('test');
```

which would return something like

```
{"test":{"id":1,"key":"test","value":"test","type":"string","created_at":"2021-12-25T10:18:07.000000Z","updated_at":"2021-12-25T10:18:07.000000Z"}}
```

keyed by the `key`.

If you just need the value, call

```
Setting::getValue('test');
```

which returns only the value, in this case `test`.

### Static export

[](#static-export)

Every change/creation of a setting is automatically updating a statically exported file, by default `settings.json` on your default filesystem disc. This should ensure a reduced Webserver load for external access by e.g. your SPA frontend so that they just need to access a for example to S3 exported CDN-cached file, without "hammering" the Webserver every time.

#### Command

[](#command)

Settings can/will be (re-)synced to your disc for static access automatically, if configured. You can (re-)sync these by calling the command

```
php artisan setting:sync
```

All settings will be exported to a json file to the configured disc.

### Controller

[](#controller)

If you have routing activated, you may access the settings via routes, e.g. `GET https://yourdomain.tld/setting/{setting}` to get a setting by key.

*Note: Routes only return values and have no `setter` endpoint!*

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [elipZis GmbH](https://elipZis.com)
- [NeA](https://github.com/nea)
- [All Contributors](https://github.com/elipZis/laravel-simple-setting/contributors)

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance55

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

4

Last Release

803d ago

PHP version history (3 changes)v1.0.0PHP ^8.0

v1.1.0PHP ^8.0|^8.1

v1.3.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46478237?v=4)[elipZis](/maintainers/elipZis)[@elipZis](https://github.com/elipZis)

---

Top Contributors

[![nea](https://avatars.githubusercontent.com/u/392035?v=4)](https://github.com/nea "nea (44 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (36 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (29 commits)")

---

Tags

laravelphplaravelSettingsconfigelipZis

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

199.4k](/packages/tarfin-labs-event-machine)

PHPackages © 2026

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