承接 sersid/yii2-config 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sersid/yii2-config

最新稳定版本:v1.0.3

Composer 安装命令:

composer require sersid/yii2-config

包简介

Yii2 manage configuration from database

README 文档

README

Manage configuration from database

Installation

One

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist sersid/yii2-config "*"

or add

"sersid/yii2-config": "*"

to the require section of your composer.json file.

Two

Applying migrations

yii migrate --migrationPath=@vendor/sersid/yii2-config/migrations

Three

$config = [
    ...
    'components' => [
        ...
        'config' => [
            'class' => 'sersid\config\components\Config',
            'coding' => '...', // json of serialize. Default 'json'
            'idConnection' => 'db', // The ID of the connection component
            'tableName' => '{{%config}}', //Config table name
            'idCache' => 'cache', // The ID of the cache component. Default null (no caching)
            'cacheKey' => 'config.component', // The key identifying the value to be cached
            'cacheDuration' => 360, // The number of seconds in which the cached value will expire. 0 means never expire. Default 0
        ],
    ]
];

Usage

Once the extension is installed, simply use it in your code by :

Set

Yii::$app->config->set('foo', 'bar');
Yii::$app->config->set('foo', ['bar', 'baz']);
Yii::$app->config->set(['foo' => 'bar']);

Get

Yii::$app->config->get('zyx'); // null
Yii::$app->config->get('zyx', 'default'); // 'default'
Yii::$app->config->get('foo', 'default'); // 'bar'
Yii::$app->config->get(['foo' => 'default']);

Delete

Yii::$app->config->delete('foo');
Yii::$app->config->deleteAll(); // delete all config

Uninstall

Applying migrations

yii migrate/down --migrationPath=@vendor/sersid/yii2-config/migrations

统计信息

  • 总下载量: 2.55k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-10-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固