Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Chepurnoy committed Jul 14, 2016
1 parent fe36871 commit 45af243
Showing 1 changed file with 44 additions and 36 deletions.
80 changes: 44 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,59 @@ to the require section of your composer.json.

Configuration
-------------
Before usage this extension, run init migration.

./yii migrate/up --migrationPath=@vendor/yii2mod/yii2-settings/migrations
**Database Migrations**

To use this extension, you have to configure the modules array in your application configuration:
Before usage this extension, we'll also need to prepare the database.

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

**Module Setup**

To access the module, you need to configure the modules array in your application configuration:
```php
'admin' => [
'admin' => [
'modules' => [
'settings' => [
'class' => 'yii2mod\settings\Module',
],
...
'settings' => [
'class' => 'yii2mod\settings\Module',
],
],
]
]
```
You can then access settings page by the following URL:

> You can then access settings page by the following URL:
http://localhost/path/to/index.php?r=admin/settings/

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

To use the Setting Component, you need to configure the components array in your application configuration:
```php
'components' => [
'settings' => [
'class' => 'yii2mod\settings\components\Settings',
],
...
]
```
## Internationalization
'components' => [
'settings' => [
'class' => 'yii2mod\settings\components\Settings',
],
]
```

Usage:
---------
```php
$settings = Yii::$app->settings;

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

$settings->set('section', 'key', 125.5);

$settings->set('section', 'key', 'false', SettingType::BOOLEAN_TYPE);

$settings->remove('section', 'key');

$settings->invalidateCache(); // automatically called on set(), remove();
```

Internationalization
----------------------

All text and messages introduced in this extension are translatable under category 'yii2mod.settings'.
You may use translations provided within this extension, using following application configuration:
Expand All @@ -77,22 +101,6 @@ return [
];
```

Usage:
--------------
```php
$settings = Yii::$app->settings;

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

$settings->set('section', 'key', 125.5);

$settings->set('section', 'key', 'false', SettingType::BOOLEAN_TYPE);

$settings->remove('section', 'key');

$settings->invalidateCache(); // automatically called on set(), remove();
```




0 comments on commit 45af243

Please sign in to comment.