PHPackages                             justcoded/yii2-settings - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. justcoded/yii2-settings

AbandonedArchivedYii2-extension[File &amp; Storage](/categories/file-storage)

justcoded/yii2-settings
=======================

Yii2 Settings Component

1.0.1(6y ago)43.8k↓33.3%2[1 issues](https://github.com/justcoded/yii2-settings/issues)1BSD-3-ClausePHPPHP &gt;=7.0.0

Since Sep 22Pushed 6y ago3 watchersCompare

[ Source](https://github.com/justcoded/yii2-settings)[ Packagist](https://packagist.org/packages/justcoded/yii2-settings)[ RSS](/packages/justcoded-yii2-settings/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (1)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

Yii2 Settings Extension
=======================

[](#yii2-settings-extension)

Replacement for Yii app params. Easy to use component to store application settings. Supports only DB storage for now. Have ready to use base Settings form model and controller Action.

### Installation

[](#installation)

The preferred way to install this extension is through composer.

Either run

```
php composer.phar require --prefer-dist justcoded/yii2-settings "*"
```

or add

```
"justcoded/yii2-settings": "*"

```

to the require section of your composer.json.

### Configuration

[](#configuration)

#### Database migration

[](#database-migration)

Before usage this extension, we'll also need to prepare the database.

You can add migrations path to your console config and then run `migrate` command:

```
'migrate' => [
    'migrationPath' => [
        '@vendor/justcoded/yii2-settings/migrations'
    ],
],
```

or you can run the command below:

```
php yii migrate --migrationPath=@vendor/justcoded/yii2-settings/migrations

```

### Component Setup

[](#component-setup)

To use the Setting Component, you need to configure the components array in your application configuration:

```
'components' => [
    'settings' => [
        'class'     => 'justcoded\yii2\settings\components\DbSettings',
    ],
],
```

and add component name to bootstrap array

```
    'bootstrap'  => ['log', 'settings'],
```

### Usage

[](#usage)

```
// set value
Yii::$app->settings->set('section_name', 'key', 'value');

// get value
$value = Yii::$app->settings->get('section_name', 'key');
```

There is a possibility to use models as some setting group object. To do this you have to add modelsMap array to component's configuration:

```
    'settings' => [
        'class'     => 'justcoded\yii2\settings\components\DbSettings',
        'modelsMap' => [
            'section1' => 'app\models\MySettingsForm1',
            'section2' => 'app\models\MySettingsForm2',
        ],
    ],
```

Add action to controller to get settings form with keys according to the model's properties

```
    public function actions()
    {
        return [
            'actionName' => [
                'class' => 'justcoded\yii2\settings\actions\SettingsAction',
                'modelClass' => 'app\models\MySettingsForm1',
            ],
        ];
    }
```

and create view with some active form. (You can copy a template from extension "views" folder)

Now you can get settings in better way:

```
$value = Yii::$app->settings->section1->myPropertyName;
```

This is very useful, if you overwrite Yii/Application classes and specify correct PHPDoc comments. In this way IDE will highlight all sections and properties.

### Example

[](#example)

You can check the example on our [Yii2 starter kit](https://github.com/justcoded/yii2-starter).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~658 days

Total

2

Last Release

2501d ago

### Community

Maintainers

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

---

Top Contributors

[![aprokopenko](https://avatars.githubusercontent.com/u/1842666?v=4)](https://github.com/aprokopenko "aprokopenko (6 commits)")[![Aleksey-Fedorenko](https://avatars.githubusercontent.com/u/41619995?v=4)](https://github.com/Aleksey-Fedorenko "Aleksey-Fedorenko (1 commits)")

---

Tags

settings-managementyii2yii2-extensionyii2-settingsSettingsconfigstorageyii2

### Embed Badge

![Health badge](/badges/justcoded-yii2-settings/health.svg)

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

###  Alternatives

[yii2mod/yii2-settings

Yii2 Settings Module

100167.4k11](/packages/yii2mod-yii2-settings)[pheme/yii2-settings

Yii2 Database settings

149727.8k7](/packages/pheme-yii2-settings)

PHPackages © 2026

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