PHPackages                             amirsahra/larasetting - 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. amirsahra/larasetting

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

amirsahra/larasetting
=====================

v1(2y ago)06MITPHP

Since Feb 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/amirsahra/larasetting)[ Packagist](https://packagist.org/packages/amirsahra/larasetting)[ RSS](/packages/amirsahra-larasetting/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Larasetting
===========

[](#larasetting)

*Larasetting Package for Laravel 9+*
------------------------------------

[](#larasetting-package-for-laravel-9)

Larasetting is a simple and efficient package for managing settings in Laravel applications. It provides a convenient way to store and retrieve settings using key-value pairs, ensuring data persistence and organization through a dedicated database table.

Features
--------

[](#features)

- asy-to-use functions: Larasetting simplifies setting management with two main functions: get\_setting() and set\_setting().
- Flexible handling of settings: Retrieve all settings or a specific setting by key. Filter settings based on their active status for specific retrieval.
- Database-backed persistence: Settings are securely stored in a dedicated database table, ensuring data integrity and persistence across application restarts.

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

[](#installation)

Install the package : Use Composer to install the package:

```
composer require amirsahra/larasetting
```

Add the following class to the providers array in config/app.php

```
Amirsahra\Larasetting\LarasettingServiceProvider::class,
```

And aliases

```
'Larasetting' => Amirsahra\Larasetting\Facades\Larasetting::class
```

Publish configuration: Publish the configuration file to customize settings:

```
php artisan vendor:publish --provider="Amirsahra\Larasetting\LarasettingServiceProvider"
```

Customize configuration: Edit the `config/larasetting.php` file to adjust table name and default status for settings.

Usage
-----

[](#usage)

This package has a facade and a helper and you can use any one you want. In the following, we will explain both methods

Larasetting provides two primary functions for managing settings:

```
// facade
getSetting('key','vlue','is_active');
setSetting('key','vlue','is_active');

// helper
get_setting('key','vlue','is_active');
set_setting('key','vlue','is_active');
```

### Using helpers functions

[](#using-helpers-functions)

#### Get setting

[](#get-setting)

Below are examples of how to use auxiliary methods to receive settings

```
/*   Get all setting  */
get_setting(); // Get all values that are active or inactive
get_setting(null, null, true); // Get all values that are active
get_setting(null, null, false); // Get all values that are inactive

/*   Get by setting key  */
// Get the value of the `key_name` key that is enabled or disabled
get_setting('key_name');

// Get the value of the `key_name` key if it is active
get_setting('key_name', null, true);

// Get the value of the `key_name` key if it is inactive
get_setting('key_name', null, false);

// Gets the value of the key_name key that is active or inactive,
// If it doesn't exist, sets it to these values.
// It is inactive by default
get_setting('key_name', 'default', null);
```

#### Set setting

[](#set-setting)

Below are examples of how to use auxiliary methods to save settings

```
set_setting(); // If the method is used without parameters, it will give an error

// At least two parameters, key and value, are required to create a setting,
// and its value is_active by default, which is equal to false
set_setting('key_name', 'vlue');

// If the key_name value already exists, it acts as an update and the value value is updated.
// It means that our setting will be updated
get_setting('key_name', 'new_value', true);
```

### Using Facade

[](#using-facade)

#### Get setting

[](#get-setting-1)

Below are examples of how to use auxiliary methods to receive settings

```
/*   Get all setting  */
Larasetting::getSetting(); // Get all values that are active or inactive
Larasetting::getSetting(null, null, true); // Get all values that are active
Larasetting::getSetting(null, null, false); // Get all values that are inactive

/*   Get by setting key  */
// Get the value of the `key_name` key that is enabled or disabled
Larasetting::getSetting('key_name');

// Get the value of the `key_name` key if it is active
Larasetting::getSetting('key_name', null, true);

// Get the value of the `key_name` key if it is inactive
Larasetting::getSetting('key_name', null, false);

// Gets the value of the key_name key that is active or inactive,
// If it doesn't exist, sets it to these values.
// It is inactive by default
Larasetting::getSetting('key_name', 'default', null);
```

#### Set setting

[](#set-setting-1)

Below are examples of how to use auxiliary methods to save settings

```
Larasetting::getSetting(); // If the method is used without parameters, it will give an error

// At least two parameters, key and value, are required to create a setting,
// and its value is_active by default, which is equal to false
Larasetting::getSetting('key_name', 'vlue');

// If the key_name value already exists, it acts as an update and the value value is updated.
// It means that our setting will be updated
Larasetting::getSetting('key_name', 'new_value', true);
```

Assign the specified value (MySite) to the setting with the key (site\_name). If the setting doesn't exist, create it with the provided value.

#### Examples

[](#examples)

Here are examples of how to use Larasetting for setting management:

#### Retrieve all settings

[](#retrieve-all-settings)

```
$settings = get_setting();
```

Retrieve all settings from the database, including their values and active statuses.

Filter settings by active status

```
$activeSettings = get_setting(null, null, true);
```

Retrieve all settings that have the active flag set to true.

#### Create a new setting

[](#create-a-new-setting)

```
set_setting('sms_key', '1234567890');
```

Create a new setting with the key (sms\_key) and value (1234567890).

#### Update an existing setting

[](#update-an-existing-setting)

```
set_setting('site_name', 'NewSiteName');
```

Update the value of the setting with the key (site\_name) to NewSiteName. If the setting doesn't exist, create it with the provided value.

Exceptions Larasetting throws a SettingRecordNotFoundException exception if a setting is not found and no default value is provided.

License
-------

[](#license)

MIT

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

823d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f79a9f6c82d9d40bbdd6796bd2c2475fe04f041cad6dc6c7de9649c71a0d998?d=identicon)[amirsahra](/maintainers/amirsahra)

---

Top Contributors

[![amirsahra](https://avatars.githubusercontent.com/u/19200842?v=4)](https://github.com/amirsahra "amirsahra (29 commits)")

### Embed Badge

![Health badge](/badges/amirsahra-larasetting/health.svg)

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

###  Alternatives

[m-a-k-o/nova-custom-table-card

Nova custom table card. Show your latest data (orders, posts,...) as card or data you prefer.

45404.5k](/packages/m-a-k-o-nova-custom-table-card)

PHPackages © 2026

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