PHPackages                             angus-dv/laravel-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. angus-dv/laravel-setting

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

angus-dv/laravel-setting
========================

Laravel Persistent Settings.

017PHP

Since Jan 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/AngusDV/laravel-setting)[ Packagist](https://packagist.org/packages/angus-dv/laravel-setting)[ RSS](/packages/angus-dv-laravel-setting/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AngusDV Laravel Settings
========================

[](#angusdv-laravel-settings)

This package makes it easy to store and retrieve some loose values. Stored values are saved as a json file.

```
Supoort Laravel 8 and PHP 8

```

It can be used like this:

```
settings('key'); // Returns 'value'

settings()->get('key'); // Returns 'value'

settings()->has('key'); // Returns true

// Specify a default value for when the specified key does not exist
settings()->get('non existing key', 'default') // Returns 'default'

settings()->put('anotherKey', 'anotherValue');

settings('anotherKey', 'anotherValue');

settings(['anotherKey'=> 'anotherValue']);

// Put multiple items in one go
settings()->put(['ringo' => 'drums', 'paul' => 'bass']);

settings()->all(); // Returns an array with all items

settings()->forget('key'); // Removes the item

settings()->flush(); // Empty the entire valuestore

settings()->flushStartingWith('somekey'); // remove all items whose keys start with "somekey"

settings()->increment('number'); // settings()->get('number') will return 1
settings()->increment('number'); // settings()->get('number') will return 2
settings()->increment('number', 3); // settings()->get('number') will return 5
```

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

[](#installation)

You can install the package via composer:

```
composer require angus-dv/laravel-setting
```

and for register service provider:

```
 'providers' => [
   AngusDV\LaravelSetting\LaravelSettingServiceProvider::class,
 ],

```

and run migration to create the database table:

```
php artisan migrate

```

Usage
-----

[](#usage)

You can call the following methods on the `settings()`

### put

[](#put)

```
/**
 * Put a value in the store.
 *
 * @param string|array $name
 * @param string|int|null $value
 *
 * @return $this
 */
public function put($name, $value = null)
```

### get

[](#get)

```
/**
 * Get a value from the store.
 *
 * @param string $name
 *
 * @return null|string
 */
public function get(string $name)
```

### has

[](#has)

```
/*
 * Determine if the store has a value for the given name.
 */
public function has(string $name) : bool
```

### all

[](#all)

```
/**
 * Get all values from the store.
 *
 * @return array
 */
public function all() : array
```

### allStartingWith

[](#allstartingwith)

```
/**
 * Get all values from the store which keys start with the given string.
 *
 * @param string $startingWith
 *
 * @return array
*/
public function allStartingWith(string $startingWith = '') : array
```

### forget

[](#forget)

```
/**
 * Forget a value from the store.
 *
 * @param string $key
 *
 * @return $this
 */
public function forget(string $key)
```

### flush

[](#flush)

```
/**
 * Flush all values from the store.
 *
 * @return $this
 */
 public function flush()
```

### flushStartingWith

[](#flushstartingwith)

```
/**
 * Flush all values from the store which keys start with the specified value.
 *
 * @param string $startingWith
 *
 * @return $this
 */
 public function flushStartingWith(string $startingWith)
```

### pull

[](#pull)

```
/**
 * Get and forget a value from the store.
 *
 * @param string $name
 *
 * @return null|string
 */
public function pull(string $name)
```

### increment

[](#increment)

```
/**
 * Increment a value from the store.
 *
 * @param string $name
 * @param int $by
 *
 * @return int|null|string
 */
 public function increment(string $name, int $by = 1)
```

### decrement

[](#decrement)

```
/**
 * Decrement a value from the store.
 *
 * @param string $name
 * @param int $by
 *
 * @return int|null|string
 */
 public function decrement(string $name, int $by = 1)
```

push
----

[](#push)

```
/**
 * Push a new value into an array.
 *
 * @param string $name
 * @param $pushValue
 *
 * @return $this
 */
public function push(string $name, $pushValue)
```

prepend
-------

[](#prepend)

```
/**
 * Prepend a new value into an array.
 *
 * @param string $name
 * @param $prependValue
 *
 * @return $this
 */
public function prepend(string $name, $prependValue)
```

count
-----

[](#count)

```
/**
 * Count elements.
 *
 * @return int
 */
public function count()
```

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

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

License
-------

[](#license)

The MIT License (MIT)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/40d6f1d20980036a861daddcf3eea18ac7b2a2bde4f81a4d05c07af410df195b?d=identicon)[marooj](/maintainers/marooj)

---

Top Contributors

[![AngusDV](https://avatars.githubusercontent.com/u/5556823?v=4)](https://github.com/AngusDV "AngusDV (7 commits)")

### Embed Badge

![Health badge](/badges/angus-dv-laravel-setting/health.svg)

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

###  Alternatives

[razonyang/yii2-rate-limiter

Yii2 Rate Limiter

1025.0k1](/packages/razonyang-yii2-rate-limiter)

PHPackages © 2026

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