https://github.com/sadi01/yii2-more-settings
https://github.com/sadi01/yii2-more-settings
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sadi01/yii2-more-settings
- Owner: Sadi01
- License: bsd-3-clause
- Created: 2022-11-19T10:39:26.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-02T09:52:28.000Z (over 2 years ago)
- Last Synced: 2025-03-09T00:04:39.987Z (2 months ago)
- Language: PHP
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
![]()
Handle settings for Yii 2
For license information check the [LICENSE](LICENSE.md)-file.
Installation
------------### 1. Download
The preferred way to install this extension is through [composer](http://getcomposer.org/download/):
```
composer require --prefer-dist sadi01/yii2-more-settings:"*"
```### 2. Configuration
To use this extension, you have to configure the PostService class in your application configuration:
```php
return [
//....
'modules' => [
'moresettings' => [
'class' => 'sadi01\moresettings\SettingsModule',
'rootAlias' => '@webroot',
'webAlias' => '@web',
],
]
];
```### 3. Update database schema
The last thing you need to do is updating your database schema by applying the
migrations. Make sure that you have properly configured `db` application component
and run the following command:```bash
$ php yii migrate/up --migrationPath=@vendor/sadi01/yii2-more-settings/src/migrations
```How To Use
-------------Manage setting categories and settings :
```php
http://yourdomain/moresettings/default/index
http://yourdomain/moresettings/setting-cat/index
```Get value of setting:
```php
use sadi01\moresettings\models\SettingValue;SettingValue::getValue('settingCategory', 'settingName')
```Setting widget for change value of setting:
```php
use sadi01\moresettings\widgets\SettingsWidget=
SettingsWidget::widget([
'model' => $model,
'categoryName' => 'mainSettings', // name of Setting category
'settingName' => 'apiBaseUrl' // name of setting
])
?>
```