PHPackages                             merodiro/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. [Caching](/categories/caching)
4. /
5. merodiro/settings

ActiveLibrary[Caching](/categories/caching)

merodiro/settings
=================

Easy global/user settings

v1.0(8y ago)352.7kMITPHPPHP ~7.0CI failing

Since Dec 23Pushed 8y ago3 watchersCompare

[ Source](https://github.com/merodiro/settings)[ Packagist](https://packagist.org/packages/merodiro/settings)[ Docs](https://github.com/Merodiro/Settings)[ RSS](/packages/merodiro-settings/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

settings
========

[](#settings)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bd8aae7812b7910f4910cda80887ab95de5cb3201f3555c2c78e74748cb64ee8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d65726f6469726f2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/merodiro/settings)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/faabf49d2898ad918ecebc6a41b59f0fb672608df9d78de2d6077694160b5ae6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d65726f6469726f2f73657474696e67732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/merodiro/settings)[![Coverage Status](https://camo.githubusercontent.com/bb04b0c2106a60b307511c336cf4777bd0d4c1511df166301e57e88b8d9687e2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6d65726f6469726f2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/merodiro/settings/code-structure)[![Quality Score](https://camo.githubusercontent.com/b7518124cdff3ef75d93ba1957101012dbad083c3e40bfa3b38ed88bba96a9b6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d65726f6469726f2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/merodiro/settings)[![Total Downloads](https://camo.githubusercontent.com/ead3bfd97d6d69012eb7fa5ab57d7ead429dc9b03f494a3f734f8ce2a01e6795/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d65726f6469726f2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/merodiro/settings)

laravel easy `key => value` global/user settings

Install
-------

[](#install)

Via Composer

```
$ composer require merodiro/settings
```

publish config through Optional: only if you want to edit cache configurations

```
$ php artisan vendor:publish --provider=Merodiro\Settings\SettingsServiceProvider
```

Setup a Model
-------------

[](#setup-a-model)

```
use Merodiro\Settings\HasSettings;

class User extends Model
{
    use HasSettings;
    ...
}
```

Usage
-----

[](#usage)

### Set settings

[](#set-settings)

creates a record if the key doesn't exist or update it if the key exists

in addition to updating the cache

```
// Global Settings
Settings::set('key', 'value');
Settings::set('key', 'another value');

// User Settings
$user->setSettings('key', 'value');
$user->setSettings('key', 'another value');
```

### Get value from settings

[](#get-value-from-settings)

Returns its value if it exists or the second parameter if it doesn't exist

```
// Global Settings
$name = Settings::get('site-name');
$value = Settings::get('key', 'default');

// User Settings
$user->getSettings('site-name');
$user->getSettings('key', 'value');
```

### Delete key from settings

[](#delete-key-from-settings)

Remove the setting with the given key in addition to removing it from the cache

```
// Global Settings
Settings::forget('key');

// User Settings
$user->forgetSettings('key');
```

### Delete all settings

[](#delete-all-settings)

Delete all the settings in addition to removing them from the cache

```
// Global Settings
Settings::flush();

// User Settings
$user->flushSettings();
```

### Get all settings

[](#get-all-settings)

Returns all settings stored in key =&gt; value array

```
// Global Settings
$settings = Settings::all();

// User Settings
$settings = $user->allSettings();
```

Artisan Commands
----------------

[](#artisan-commands)

### Cache all settings

[](#cache-all-settings)

Caches all settings for the duration that has been set in settings.php config file

*you can set the duration to a high number or schedule the command to run often to get the best value of it*

```
# Global settings only
php artisan settings:cache

# Global and User Settings
php artisan settings:cache --model=App/User
```

### Clear cache for all settings

[](#clear-cache-for-all-settings)

```
# Global settings only
$ php artisan settings:clear

# Global and User Settings
$ php artisan settings:clear --model=App/User
```

Blade Directives
----------------

[](#blade-directives)

### Get value from blade template

[](#get-value-from-blade-template)

```
@settings('site-name')
@settings('site-name', 'default name')
```

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Amr A. Mohammed](https://github.com/merodiro)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

3004d ago

Major Versions

v0.3.1 → v1.02018-04-10

PHP version history (2 changes)v0.1PHP ~5.6|~7.0

v0.2PHP ~7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17033502?v=4)[Amr Gad](/maintainers/merodiro)[@merodiro](https://github.com/merodiro)

---

Top Contributors

[![merodiro](https://avatars.githubusercontent.com/u/17033502?v=4)](https://github.com/merodiro "merodiro (32 commits)")

---

Tags

cachelaravelpackagesettingsusersettingsSettingsMerodiro

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M68](/packages/spatie-laravel-responsecache)[illuminate/cache

The Illuminate Cache package.

12937.0M1.7k](/packages/illuminate-cache)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21111.6k](/packages/iazaran-smart-cache)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5443.8k](/packages/hasinhayder-tyro-dashboard)

PHPackages © 2026

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