PHPackages                             cmarfil/laravel-multiuser-json-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. cmarfil/laravel-multiuser-json-settings

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

cmarfil/laravel-multiuser-json-settings
=======================================

Simple user json settings facade for Laravel 4.

v1.1.3(11y ago)6275MITPHPPHP &gt;=5.4.0

Since Jan 21Pushed 11y ago1 watchersCompare

[ Source](https://github.com/cmarfil/laravel-multiuser-json-settings)[ Packagist](https://packagist.org/packages/cmarfil/laravel-multiuser-json-settings)[ Docs](https://github.com/cmarfil/laravel-multiuser-json-settings)[ RSS](/packages/cmarfil-laravel-multiuser-json-settings/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (8)Used By (0)

laravel-multiuser-json-settings
===============================

[](#laravel-multiuser-json-settings)

Simple user settings facade for Laravel 4. Settings are stored as JSON in a single database column, so you can easily add it to an existing table (`users` for example).

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

[](#installation)

1. Begin by installing this package through Composer. Edit your project's composer.json file to require cmarfil/laravel-multiuser-json-settings. ```
    "require": {
    	"cmarfil/laravel-multiuser-json-settings": "~1.1"
    }

    ```
2. Add `'Cmarfil\LaravelMultiUserJsonSettings\ServiceProvider'` to `providers` in `app/config/app.php`.

```
'providers' => array(
  // ...
  'Cmarfil\LaravelMultiUserJsonSettings\ServiceProvider',
),
```

3. Add `'Setting' => 'Cmarfil\LaravelMultiUserJsonSettings\Facade'` to `aliases` in `app/config/app.php`.

```
'aliases' => array(
  // ...
  'Setting' => 'Cmarfil\LaravelMultiUserJsonSettings\Facade',
),
```

4. Run `php artisan config:publish cmarfil/laravel-multiuser-json-settings` to publish the config file.
5. Modify the published configuration file located at `app/config/packages/cmarfil/laravel-multiuser-json-settings/config.php` to your liking.
6. Create a varchar (string) column in a table on your database to match the config file in step 5. Alternatively, use the Laravel migration included in this package to automatically create a `settings` column in the `users` table: `php artisan migrate --package=cmarfil/laravel-multiuser-json-settings`.

Configuration
-------------

[](#configuration)

Pop open `app/config/packages/cmarfil/laravel-multiuser-json-settings/config.php` to adjust package configuration. If this file doesn't exist, run `php artisan config:publish cmarfil/laravel-multiuser-json-settings` to create the default configuration file.

```
return array(
    'table' => 'users',
    'column' => 'settings',
	'constraint_key' => 'id',
	'default_constraint_value' => (Auth::check() ? Auth::id() : null)
	'custom_constraint' => false, //'id = ' . (Auth::check() ? Auth::id() : null),
);
```

#### Table

[](#table)

Specify the table on your database that you want to use.

#### Column

[](#column)

Specify the column in the above table that you want to store the settings JSON data in.

#### Constraint key

[](#constraint-key)

Specify the column constraint - this is used to differentiate between different users, objects or models ( normally id ).

#### Default constraint value

[](#default-constraint-value)

Specify the default constraint value - If you do not specify one, default configuration is obtained, in this case the user logged.

#### Custom constraint

[](#custom-constraint)

Specify a where clause for each query - Caution: Leave blank if your want to set or get different rows on same runtime, use constraint\_key and default\_constraint\_value

Usage
-----

[](#usage)

Use the Setting facade (`Setting::`) to access the functions in this package.

#### Set

[](#set)

```
Setting::set('key', 'value', $constraint_value);
```

Use `set` to change the value of a setting. If the setting does not exist, it will be created automatically. You can set multiple keys at once by passing an associative (key=&gt;value) array to the first parameter. If you do not pass constraint\_value the value used by default is default\_constraint\_value

#### Get

[](#get)

```
Setting::get('key', 'default', $constraint_value);
```

Use `get` to retrieve the value of a setting. The second parameter is optional and can be used to specify a default value if the setting does not exist (the default default value is `null`). If you do not pass constraint\_value the value used by default is default\_constraint\_value

#### Forget

[](#forget)

```
Setting::forget('key', $constraint_value);
```

Unset or delete a setting by calling `forget`. If you do not pass constraint\_value the value used by default is default\_constraint\_value

#### Has

[](#has)

```
Setting::has('key', $constraint_value);
```

Check for the existence of a setting, returned as a boolean. If you do not pass constraint\_value the value used by default is default\_constraint\_value

#### All

[](#all)

```
Setting::all($constraint_value);
```

Retrieve all settings as an associative array (key=&gt;value). If you do not pass constraint\_value the value used by default is default\_constraint\_value

#### Save

[](#save)

```
Setting::save($constraint_value);
```

Save all changes back to the database. This will need to be called after making changes; it is not automatic. If you do not pass constraint\_value the value used by default is default\_constraint\_value

#### Load

[](#load)

```
Setting::load($constraint_value);
```

Reload settings from the database. This is called automatically if settings have not been loaded before being accessed or mutated. If you do not pass constraint\_value the value used by default is default\_constraint\_value

\##Example With default configuration:

```
return array(
    'table' => 'users',
    'column' => 'settings',
	'constraint_key' => 'id',
	'default_constraint_value' => (Auth::check() ? Auth::id() : null)
	'custom_constraint' => false, //'id = ' . (Auth::check() ? Auth::id() : null),
);
```

The following set and returns the **user logged** setting "email\_notification"

```
//Set email_notifications setting to false
Setting::set('email_notifications', false);

//Save config
Setting::save();

//Save email_notifications
return Setting::get('email_notifications');
```

The following set and returns the setting "email\_notification" for **user with id 23**

```
//Set email_notifications setting to false
Setting::set('email_notifications', false, 23);

//Save config
Setting::save(23);

//Save email_notifications
return Setting::get('email_notifications', true, 23);
```

Finally
-------

[](#finally)

#### Contributing

[](#contributing)

Feel free to create a fork and submit a pull request if you would like to contribute.

#### Bug reports

[](#bug-reports)

Raise an issue on GitHub if you notice something broken.

#### Credits

[](#credits)

Fork of . Based loosely on .

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

7

Last Release

4152d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/798849?v=4)[Cristian Marfil](/maintainers/cmarfil)[@cmarfil](https://github.com/cmarfil)

---

Top Contributors

[![Grimthorr](https://avatars.githubusercontent.com/u/5190473?v=4)](https://github.com/Grimthorr "Grimthorr (11 commits)")

---

Tags

jsonlaravelSettingsuser

### Embed Badge

![Health badge](/badges/cmarfil-laravel-multiuser-json-settings/health.svg)

```
[![Health](https://phpackages.com/badges/cmarfil-laravel-multiuser-json-settings/health.svg)](https://phpackages.com/packages/cmarfil-laravel-multiuser-json-settings)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M200](/packages/laravel-ai)

PHPackages © 2026

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