simplator/settings

This package is abandoned and no longer maintained. No replacement package was suggested.

Yii2 Database multidomain settings

Installs: 167

Dependents: 3

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 3

Type:yii2-extension

0.2.1 2015-12-22 14:15 UTC

This package is not auto-updated.

Last update: 2018-07-21 13:01:26 UTC


README

Yii2 Database settings storage

Latest Stable Version Total Downloads Latest Unstable Version License

Added multidomain configuration

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist simplator/settings "*"

or add

"simplator/settings": "*"

to the require section of your composer.json file.

Subsequently, run

./yii migrate/up --migrationPath=@vendor/simplator/settings/migrations

in order to create the settings table in your database.

Usage

There are 2 parts to this extension. A module and a component. The module provides a simple GUI to edit your settings. The component provides a way to retrieve and save settings programmatically.

Add this to your main configuration's modules array

	'modules' => [
        'settings' => [
            'class' => 'simplator\settings\Module',
        ],
        ...
	],

Add this to your main configuration's components array

	'components' => [
		'settings' => [
        	'class' => 'simplator\settings\components\Settings'
        ],
        ...
	]

Typical component usage


$settings = Yii::$app->settings;

$value = $settings->get('section.key');

$value = $settings->get('section.key', 'default');

$settings->set('section.key', 'value');

// Automatically called on set();
$settings->flushSettings();