PHPackages                             mix8872/yii2-config - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mix8872/yii2-config

ActiveYii2-extension[Database &amp; ORM](/categories/database)

mix8872/yii2-config
===================

Module for store config in db

3.0.0(3y ago)06321MITPHPPHP &gt;=7.1.0

Since Aug 19Pushed 3y agoCompare

[ Source](https://github.com/mix8872/yii2-config)[ Packagist](https://packagist.org/packages/mix8872/yii2-config)[ RSS](/packages/mix8872-yii2-config/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (7)Versions (6)Used By (1)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist mix8872/config

```

or add

```
"mix8872/yii2-config": "dev-master"
```

to the `require` section of your `composer.json`.

Configuration
-------------

[](#configuration)

Edit `components` section of your application config file.

Common:

```
'components' => [
    'config' => [
        'class' => 'mix8872\config\components\Config'
    ],

// other components
]
```

Edit `controllerMap` and `modules` section of your application config file.

Backend:

```
'controllerMap' => [
    'elfinder' => [
        'class' => 'mihaildev\elfinder\Controller',
        'access' => ['admin'], //глобальный доступ к фаил менеджеру @ - для авторизорованных , ? - для гостей , чтоб открыть всем ['@', '?']
        'disabledCommands' => ['netmount'], //отключение ненужных команд https://github.com/Studio-42/elFinder/wiki/Client-configuration-options#commands
        'roots' => [
            [
                'baseUrl'=>'@web',
                'basePath'=>'@webroot',
                'path' => 'uploads',
                'name' => 'Uploads',
                'options' => [
                    'uploadOverwrite' => false,
                    'uploadAllow' => ['*'],
                    // 'uploadDeny' => ['pdf'],
                    'uploadOrder' => ['allow', 'deny'],
                    'uploadMaxSize' => '50M',
                    'disabled' => ['mkfile'],
                ],
            ]
        ]
    ],

    // other controllers
],
],
'modules' => [
    'config' => [
        'class' => 'mix8872\config\Module',
        'adminRole' => 'admin', // optional, defines all rights on options editing for role
        'as access' => [
            'class' => 'yii\filters\AccessControl',
            'rules' => [
                [
                    'allow' => true,
                    'roles' => ['admin']
                ],
            ]
        ]
    ],
    'gridview' =>  [
        'class' => '\kartik\grid\Module'
        // enter optional module parameters below - only if you need to
        // use your own export download action or custom translation
        // message source
        // 'downloadAction' => 'gridview/export/download',
        // 'i18n' => []
    ],

    // other modules
]
```

If declared `adminRole` then other user which haven't declared permissions can't create

Next run migration:

```
yii migrate --migrationPath=@vendor/mix8872/yii2-config/src/migrations

```

Usage
-----

[](#usage)

Now you can open url \\config\\ and manage you params

**To get param value:**

- Yii::$app-&gt;config-&gt;&lt;param\_key&gt;
- or Yii::$app-&gt;config-&gt;g('param\_key')

**To set param value from code:**

- Yii::$app-&gt;config-&gt;&lt;param\_key&gt; = &lt;param\_value&gt;
- or Yii::$app-&gt;config-&gt;s(&lt;param\_key&gt;, &lt;param\_value&gt;)
- or Yii::$app-&gt;config-&gt;s('&lt;param\_key&gt;,&lt;param\_value&gt;')
- or Yii::$app-&gt;config-&gt;s(\[&lt;param\_key&gt;,&lt;param\_value&gt;\])
- or Yii::$app-&gt;config-&gt;s(\[&lt;param\_key&gt; =&gt; &lt;param\_value&gt;\])

Events
------

[](#events)

Config module has next events:

- EVENT\_AFTER\_CREATE - fires on config option was added
- EVENT\_AFTER\_UPDATE - fires on config option was updated
- EVENT\_AFTER\_DELETE - fires on config option was deleted
- EVENT\_BEFORE\_SAVE - fires on each config option was saved

You can catch this events in config this way:

```
'modules' => [
    'config' => [
        'class' => 'mix8872\config\Module',
        'on ' . \mix8872\config\Module::EVENT_AFTER_CREATE => function ($e) {
            $model = $e->model;
            // do something
        },
        'on ' . \mix8872\config\Module::EVENT_AFTER_UPDATE => function ($e) {
            $model = $e->model;
            // do something
        },
        'on ' . \mix8872\config\Module::EVENT_AFTER_DELETE => function ($e) {
            $model = $e->model;
            // do something
        },
        'on ' . \mix8872\config\Module::EVENT_BEFORE_SAVE => function ($e) {
            $model = $e->model;
            // do something
        },
    ]
]
```

In `$e->model` the event passes an object (or array of objects) of config items.

In `EVENT_BEFORE_SAVE` event the model is passed by reference
and can be modified from event handler.

Access rules
------------

[](#access-rules)

You can define access rules for config options by define adminRole in config
or set rules inside config options. Access matrix you can find [here](access_matrix.txt).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~333 days

Total

5

Last Release

1173d ago

Major Versions

1.1.1 → 2.0.02020-04-23

2.1.0 → 3.0.02023-04-14

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25277872?v=4)[mix8872](/maintainers/mix8872)[@mix8872](https://github.com/mix8872)

![](https://www.gravatar.com/avatar/e8595388ae74128f6bf6f1ddc15d043d5d40b462053f17e5ebd262990e5702b6?d=identicon)[demyanenkomaks](/maintainers/demyanenkomaks)

---

Top Contributors

[![mix8872](https://avatars.githubusercontent.com/u/25277872?v=4)](https://github.com/mix8872 "mix8872 (26 commits)")[![demyanenkomaks](https://avatars.githubusercontent.com/u/59017297?v=4)](https://github.com/demyanenkomaks "demyanenkomaks (6 commits)")

### Embed Badge

![Health badge](/badges/mix8872-yii2-config/health.svg)

```
[![Health](https://phpackages.com/badges/mix8872-yii2-config/health.svg)](https://phpackages.com/packages/mix8872-yii2-config)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[yiisoft/yii2-app-advanced

Yii 2 Advanced Project Template

1.7k960.6k5](/packages/yiisoft-yii2-app-advanced)[yiisoft/yii2-app-basic

Yii 2 Basic Project Template

6761.8M8](/packages/yiisoft-yii2-app-basic)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13725.7k53](/packages/skeeks-cms)[johnitvn/yii2-ajaxcrud

Gii CRUD template for Single Page Ajax Administration for yii2

97213.6k16](/packages/johnitvn-yii2-ajaxcrud)[sjaakp/yii2-sortable-behavior

Sort ActiveRecords and related records in Yii2.

36162.8k](/packages/sjaakp-yii2-sortable-behavior)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
