An easy way to intergrate Database Settings with Laravel.

Installs: 376

Dependents: 0

Suggesters: 0

Stars: 9

Watchers: 2

Forks: 4

Open Issues: 3

v2.0.2 2016-05-16 08:28 UTC


Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality

For Laravel 4.x, check version 1.5.5

Think of Setter as an easy way to integrate Settings with Laravel, providing a variety of helpers to speed up the utilisation of application wide settings. These include:

  • Setting::set
  • Setting::get
  • Setting::forget
  • Setting::has
  • Setting::all
  • Setting::clear
  • Setting::expires


Begin by installing this package through Composer. Edit your project's composer.json file to require cornford/setter.

"require": {
    "cornford/setter": "2.*"

Next, update Composer from the Terminal:

composer update

We now have to publish the packages assets with the following command:

php artisan vendor:publish --provider="Cornford\\Setter\\SettingServiceProvider"

We now have to migrate the package database table with the following command:

php artisan migrate

Once this operation completes, the next step is to add the service provider. Open config/app.php, and add a new item to the providers array.


The final step is to introduce the facade. Open config/app.php, and add a new item to the aliases array.

'Setting'         => 'Cornford\Setter\Facades\SettingFacade',

That's it! You're all set to go.


It's really as simple as using the Setter class in any Controller / Model / File you see fit with:


This will give you access to


The set method sets a setting via both a key and a value parameter in the database.

Setting::set('app.url', 'http://localhost');


The get method gets a setting via a key parameter from the database, and a default value can be optionally passed if the setting doesn't exist. If no default parameter is supplied, and an application configration variable is present, this will be returned.

Setting::get('app.url', 'http://localhost');


The forget method removes a setting via a key paramter from the database.



The has method returns a true / false based on if a setting is present in the database via a key paramter. This doesn't fall back to checking application configuration variables.



The all method returns an array of key value pairs of settings from the database. This doesn't fall back to return application configuration variables.



The clear removes all settings from the database. This doesn't fall back to removing application configuration variables.



The expires sets the cache expiry setting. Can be false to not cache, true / 0 to cache indefinitely, an integer for minutes, or a datetime of when to expire.



Setter is open-sourced software licensed under the MIT license