定制 phuongdev89/yii2-setting 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

phuongdev89/yii2-setting

Composer 安装命令:

composer require phuongdev89/yii2-setting

包简介

Yii2 Setting for other application

README 文档

README

Yii2 Setting for other application

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require phuongdev89/yii2-setting "*"

or add

"phuongdev89/yii2-setting": "*"

to the require section of your composer.json file.

Usage

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

Migration

Migration run

yii migrate --migrationPath=@phuongdev89/setting/migrations

Config /common/config/main.php to use Yii::$app->setting

    'components' => [
        'setting' => [
            'class' => 'phuongdev89\setting\Setting',
        ],
    ],

Config backend modules in backend/config/main.php to manage settings

    'modules'    => [
   		'setting'  => [
			'class'               => 'phuongdev89\setting\Module',
			'controllerNamespace' => 'phuongdev89\setting\controllers',
			'enableMultiLanguage' => false,//set true if phuongdev89/yii2-multi-language installed and want to translate setting
   		],
   		'gridview' => [
            'class' => '\kartik\grid\Module',
   		],
   		'roxymce'  => [
            'class' => '\phuongdev89\roxymce\Module',
   		],
    ],

Config at backend

backend : http://you-domain/backend/web/setting ####Attention:

  • Store Range required if type in (select, multiselect, checkbox, radio), supported string with comma, json, callback function.
    Example:
    - String: 1,2,3 or A,bcd,ef
    - Json: {"0" : "abc", "1" : "def"}
    - Callback: app\helpers\ArrayHelper::getItems()
    Just create simple static function named getItems in app\helpers\ArrayHelper
namespace app\helpers;

class ArrayHeper {

   public static function getItems(){
       return [
           0     => "abc",
           1     => "def",
           "ghi" => 2,
       ];
   }

}

Use Your Setting

Once you set the value at the backend. Simply access your setting by the following code (auto-suggest code worked):

echo Yii::$app->setting->get('siteName');
echo Yii::$app->setting->siteName;

统计信息

  • 总下载量: 133
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固