2017 © Pedro Peláez
 

yii2-extension yii2-insight-registry

Registry management

image

innologica/yii2-insight-registry

Registry management

  • Wednesday, July 26, 2017
  • by phreakbg
  • Repository
  • 0 Watchers
  • 0 Stars
  • 66 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Registry

A Yii2 plug-in for storing hierarchical low level settings., (*1)

Installation

php composer.phar require --prefer-dist innologica/yii2-insight-registry "*"

or add, (*2)

"innologica/yii2-insight-registry": "*"

to the require section of your composer.json file., (*3)

Configuration

Run migrations:, (*4)

$ ./yii migrate --migrationPath=vendor/innologica/yii2-insight-registry/migrations

Add the registry component to your components' section:, (*5)

'components' => [
    'registry' => [
        'class' => '\insight\registry\components\Registry',
    ],
    'cache' => [
        'class' => 'yii\caching\FileCache', // Or something else
    ],
    ...
],

Note: The registry plugin uses cache. Don't forget to add and adjust a cache component as well!, (*6)

Usage

To set a setting:, (*7)

<?= Yii::$app->registry->set('settingKey', 'settingValue'); ?>

To set a setting for a specific user:, (*8)

<?= Yii::$app->registry->get('settingKey', 'settingValue', 123); ?>

To get a setting:, (*9)

<?= Yii::$app->registry->get('settingKey'); ?>

To get a setting for a specific user:, (*10)

<?= Yii::$app->registry->get('settingKey', 123); ?>

Settings management

The most common way of adding/updating settings is through the RegistryForm. To create the form you must pass the settings that you want to edit like that:, (*11)

$model = Yii::createObject([
    'class' => \insight\registry\models\forms\RegistryForm::className(),
    'settings' => [
        'settingKey.subkey1' => 'value 1',
        ...
    ],
]);

The form communicates with the registry component and will overwrite those RegistryForm::$settings that are found in the cache., (*12)

In the view:, (*13)

<?= $form->field($model, 'settingKey.subkey1')->textInput(); ?>

The label of the afore mentioned field will be Subkey1., (*14)

To remove all settings from the registry:, (*15)

Yii::$app->registry->clear();

NOTE!!! The settings will be deleted from the cache as well as their mirror in the database!, (*16)

The Versions

26/07 2017

dev-master

9999999-dev https://bitbucket.org/innologica/yii2-insight-registry

Registry management

  Sources   Download

Apache-2.0

The Requires

 

by Nikolay Traykov
by Nikola Kostadinov

extension yii2 registry insight innologica

26/07 2017

dev-feature/vue

dev-feature/vue https://bitbucket.org/innologica/yii2-insight-registry

Registry management

  Sources   Download

Apache-2.0

The Requires

 

by Nikolay Traykov
by Nikola Kostadinov

extension yii2 registry insight innologica

29/09 2016

dev-laravel-mix

dev-laravel-mix

Registry management

  Sources   Download

Apache-2.0

The Requires

 

by Nikolay Traykov
by Nikola Kostadinov

extension yii2 registry insight innologica