承接 zakharov-andrew/yii2-settings 相关项目开发

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

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

zakharov-andrew/yii2-settings

最新稳定版本:v0.2.1

Composer 安装命令:

composer require zakharov-andrew/yii2-settings

包简介

Yii2 Settings

README 文档

README

Latest Stable Version License Yii2

Yii2 settings with database module with GUI manager supported.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require zakharov-andrew/yii2-settings

or add

"zakharov-andrew/yii2-settings": "*"

to the require section of your composer.json file.

Subsequently, run

./yii migrate/up --migrationPath=@vendor/zakharov-andrew/yii2-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' => 'ZakharovAndrew\settings\Module',
            'bootstrapVersion' => 5, // if use bootstrap 5
        ],
        // ...
    ],

Add this to your main configuration's components array

    'components' => [
        'settings' => [
            'class' => 'ZakharovAndrew\settings\Settings',
        ],
    ],

Add a new rule for urlManager of your application's configuration file, for example:

'urlManager' => [
    'rules' => [
        'settings' => 'settings/default/index',
        'settings/create' => 'settings/default/create',
        'settings/update' => 'settings/default/update',
        'settings/delete' => 'settings/default/delete',
        'setting-groups/create' => 'settings/setting-groups/create',
        'setting-groups/update' => 'settings/setting-groups/update',
        'setting-groups/delete' => 'settings/setting-groups/delete',
    ],
],

Typical component usage

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

$valueList = $settings->get('group1');

$value = $settings->get('group1', 'key');

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

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

👥 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

yii2-settings it is available under a BSD 3-Clause License. Detailed information can be found in the LICENSE.md.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-05