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

ActiveLibrary

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 1mo 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 1mo ago

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

43

—

FairBetter than 91% of packages

Maintenance60

Regular maintenance activity

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity67

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

750d 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://www.gravatar.com/avatar/02667081c84600d32d3afcab149a1e7c81c5421eff4411541b9658755da2bbc1?d=identicon)[elipZis](/maintainers/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

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[elipzis/laravel-cacheable-model

Automatic query-based model cache for your Laravel app

15546.1k](/packages/elipzis-laravel-cacheable-model)[outerweb/settings

Application wide settings stored in your database

4899.2k5](/packages/outerweb-settings)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)

PHPackages © 2026

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