pesto/yii2-variable

A simple solution for the storage of variables in the database
17
Install
composer require pesto/yii2-variable
Latest Version:0.1.1
License:none
Last Updated:Apr 11, 2016
Links: GitHub  ·  Packagist
Maintainer: Pesto

Install

Выполните команду

$ php composer.phar require pesto/yii2-variable "*"

или добавьте

"pesto/yii2-variable": "*"

в секцию require вашего composer.json файла.

Выполните миграции

./yii migrate/up --migrationPath=@vendor/pesto/yii2-variable/migrations

Configuration

Добавьте следующее в ваш конфигурационный файл:

<?php
...
    'components' => [
      'variable' => [
        'class' => 'pesto\variable\Variable',
      ]
      ...
    ],
...

Usage

Теперь можно в любом месте кода сохранить переменную:

 <?php Yii::$app->variable->set(<name>, <value>) ?>

или получить значение уже сохраненной переменной:

 <?php Yii::$app->variable->get(<name>, <default_value>) ?>

Related Packages

cyneek/yii2-routes

Routing and filtering extension system for Yii2 framework that emulates the Lara...

2,092 20
trandangtri/yii2-giiall

Using Yii2-Gii to generate code for other PHP framework, such as PhalconEye, Lar...

26 2
mythteam/yii2-schedule

Schedule component port from laravel

39 2
demi/php-gearman

Gearman job server workers helper

6,956 17
sngrl/string-blade-compiler

Render Blade templates from string variable

24,804 8