finagin / laravel-settings by finagin

Settings for Laravel 5.4 and up
14
0
2
Package Data
Maintainer Username: finagin
Maintainer Contact: Igor@Finag.in (Igor Finagin)
Package Create Date: 2017-05-09
Package Last Update: 2017-05-09
Language: PHP
License: MIT
Last Refreshed: 2024-12-19 03:24:44
Package Statistics
Total Downloads: 14
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Settings for Laravel 5.4 and up

Installation

This package can be used in Laravel 5.4 or higher. You can install the package via composer:

composer require finagin/laravel-settings

Now add the service provider in config/app.php file:

'providers' => [
    /*
     * Package Service Providers...
     */
    // ...
    Finagin\Settings\SettingsServiceProvider::class,
    // ...
];

You must publish the migration with:

php artisan vendor:publish --provider="Finagin\Settings\SettingsServiceProvider" --tag="migrations"

After the migration has been published you must create the settings-tables by running the migrations:

php artisan migrate

Also you can publish the config file with:

php artisan vendor:publish --provider="Finagin\Settings\SettingsServiceProvider" --tag="config"

Usage

$key = 'some_key';
$value = 'some value';
$default = 'default value';

echo Settings::get($key, $default));
// output: default value

Settings::set($key, $value));
echo Settings::get($key, $default));
// output: some value

echo Settings::unset($key));
// output: true
echo Settings::unset($key));
// output: false

echo Settings::get($key, $default));
// output: default value

License

The MIT License (MIT). Please see License File for more information.