PHPackages                             corleone/user-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. corleone/user-settings

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

corleone/user-settings
======================

A simple laravel package to manage user settings in your project.

4181PHP

Since Feb 28Pushed 8y agoCompare

[ Source](https://github.com/philippe-corleone/user-settings)[ Packagist](https://packagist.org/packages/corleone/user-settings)[ RSS](/packages/corleone-user-settings/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

user-settings
=============

[](#user-settings)

This package is a Laravel 5 package. It handles the user settings for a logged in user.

> This is my first public released Laravel package. If you have some nice ideas to expand and/or optimize it than post it or fork it! I'm always happy to learn something new.

Requirements
------------

[](#requirements)

- Laravel &gt;=5
- PHP &gt;=7

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

[](#installation)

1. At first, add the package to your `composer.json`:

```
composer require "corleone/user-settings"

```

2. Open your `config/app.php` and add the folloing line to your aliases:

```
'UserSettings' => \Corleone\UserSettings\UserSettings::class,
```

3. Publish the migration and the `config/user-sattings.php` file with the following command using your terminal:

```
php artisan vendor:publish
php artisan user-settings:migration

```

4. Run `php artisan migrate` to add the settings column to your users table. (Note: If you customize this file, copy this to youR `database/migrations` directory and do this, than run this command)
5. In your `config/user-settings.php` you can see a twodimensional array, which you can configurate now:

```
'database' => [
    'table' => 'users',
    'column' => 'settings',
    'primary_key' => 'id'
],
'settings' => [
    // insert here your settings
]
```

Configuration of the `config/user-settings.php` file
----------------------------------------------------

[](#configuration-of-the-configuser-settingsphp-file)

Set `table`, `column` and `primary_key` to match your user table. The `primary_key` should be the users id.

In the `settings` array you can set your default values for the specific settings, e.g.:

```
'database' => [
    'table' => 'users',
    'column' => 'settings',
    'primary_key' => 'id'
],
'settings' => [
    'display_time' => 7,
    'be_logged_in' => false,
    'background_color' => 'black',
    'what_else' => '1.2'
]
```

Usage
-----

[](#usage)

You can use the `UserSettings` class in controllers and views. The settings will be stored as json into your settings column.

> Note: If you want to use it in a controller or class you have to set `use Corleone\UserSettings\UserSettings;`

### Set a setting

[](#set-a-setting)

This method will set (if the setting is defined in your `config/user-settings.php` file) or add (if the default is not defined) a setting to the json.

```
UserSettings::set(string [setting], [value]);
```

> Note: Set method will match the data typ from the `config/user-settings.php` value, if they exists. So you can better develop your application.

### Set default settings

[](#set-default-settings)

This method will set the default settings from your `config/user-settings.php` file to the users table.

```
UserSettings::setDefaultSettings();
```

### Reset a Setting

[](#reset-a-setting)

This method will reset a setting to the default from your `config/user-settings.php` file, if they exists. Otherwise it will delete it simlpy from the json.

```
UserSettings::reset(string [setting]): bool;
```

This method will return `true` if the setting was set to default from the `config/user-settings.php` file and `false` if the setting was simply deleted.

> Note: If you want to reset all settings of a user, use the `PHP UserSettings::SetDefaultSettings()`

### Get a setting

[](#get-a-setting)

This method will return the value of a setting.

```
UserSettings::get(string [setting]);
```

### Get all settings

[](#get-all-settings)

This method will return all settings as an object.

```
UserSettings::all(): object;
```

### Ask if a user have a specific setting

[](#ask-if-a-user-have-a-specific-setting)

This method will return `true` if a user has a setting otherwise it will return `false`.

```
UserSettings::has(string [setting]): bool;
```

### Save settings

[](#save-settings)

All settings will saved automatically.

License
-------

[](#license)

This package is free software distributed under the terms of the MIT license.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/401f6c6f3ab8affac3ebc8b9ed17782455c4c5a18c248334ebc4fb22f37e0755?d=identicon)[philippe-corleone](/maintainers/philippe-corleone)

---

Top Contributors

[![philippe-corleone](https://avatars.githubusercontent.com/u/26930770?v=4)](https://github.com/philippe-corleone "philippe-corleone (8 commits)")

### Embed Badge

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

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

###  Alternatives

[helhum/dotenv-connector

Makes it possible to set environment variables for composer projects.

1594.6M34](/packages/helhum-dotenv-connector)[phpro/grumphp-shim

GrumPHP Phar distribution

274.4M307](/packages/phpro-grumphp-shim)

PHPackages © 2026

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