2017 © Pedro Peláez
 

library laravel-settings

Laravel 5 Persistent Settings

image

efriandika/laravel-settings

Laravel 5 Persistent Settings

  • Thursday, January 26, 2017
  • by efriandika
  • Repository
  • 2 Watchers
  • 51 Stars
  • 22,627 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 24 Forks
  • 8 Open issues
  • 11 Versions
  • 3 % Grown

The README.md

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Laravel-Settings

Laravel 5.1.x Persistent Settings (Database + Cache), (*2)

Attention: for update to v1.2.0

Re-Publish new migration file, (*3)

$ php artisan vendor:publish --provider="Efriandika\LaravelSettings\SettingsServiceProvider" --force

And run, (*4)

$ php artisan migrate

How to Install

Require this package with composer (Packagist) using the following command:, (*5)

composer require efriandika/laravel-settings

or modify your composer.json:, (*6)

   "require": {
      "efriandika/laravel-settings": "1.*"
   }

then run composer update:, (*7)

After updating composer, Register the ServiceProvider to the providers array in config/app.php, (*8)

'Efriandika\LaravelSettings\SettingsServiceProvider',

Add an alias for the facade to aliases array in your config/app.php, (*9)

'Settings'  => Efriandika\LaravelSettings\Facades\Settings::class,

Publish the config and migration files now (Attention: This command will not work if you don't follow previous instruction):, (*10)

$ php artisan vendor:publish --provider="Efriandika\LaravelSettings\SettingsServiceProvider" --force

Change config/settings.php according to your needs. If you change db_table, don't forget to change the table's name in the migration file as well., (*11)

Create the settings table., (*12)

$ php artisan migrate

How to Use it?

Set a value, (*13)

Settings::set('key', 'value');

Get a value, (*14)

$value = Settings::get('key');

Get a value with Default Value., (*15)

$value = Settings::get('key', 'Default Value');

Note: If key is not found (null) in cache or settings table, it will return default value, (*16)

Get a value via an helper, (*17)

$value = settings('key');
$value = settings('key', 'default value');

Forget a value, (*18)

Settings::forget('key');

Forget all values, (*19)

Settings::flush();

Fallback to Laravel Config (available in v1.2.0)

How to activate?, (*20)

// Change your config/settings.php
'fallback'   => true

Example, (*21)

/* 
 * If the value with key => mail.host is not found in cache or DB of Larave Settings
 * it will return same value as config::get('mail.host');
 */     
Settings::get('mail.host');

Note: It will work if default value in laravel setting is not set, (*22)

Changelogs

v1.2.0 - Dec 16th, 2015, (*23)

  • Bugs fix
  • Adding Feature: Fallback Value

To Do

License

The Laravel 5 Persistent Settings is open-sourced software licensed under the MIT license, (*24)

The Versions

26/01 2017

dev-master

9999999-dev

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

26/01 2017

v1.2.5

1.2.5.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

27/09 2016

v1.2.4

1.2.4.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

04/01 2016

v1.2.3

1.2.3.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

30/12 2015

v1.2.2

1.2.2.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

18/12 2015

v1.2.1

1.2.1.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

15/12 2015

v1.2.0

1.2.0.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

15/06 2015

v1.1.0

1.1.0.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

13/04 2015

dev-labs

dev-labs

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

13/04 2015

v1.0.1

1.0.1.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent

13/04 2015

v1.0.0

1.0.0.0

Laravel 5 Persistent Settings

  Sources   Download

MIT

The Requires

 

The Development Requires

by Efriandika Pratama

laravel settings persistent