koperdog/yii2-sitemanager

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Settings for multilanguage, multidomain site

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 1

Open Issues: 0

Type:yii2-extension

1.0.0 2019-12-22 15:51 UTC

This package is auto-updated.

Last update: 2021-09-05 15:03:06 UTC


README

Settings for multilanguage, multidomain site

Packagist Packagist Version

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist koperdog/yii2-sitemanager "*"

or add

"koperdog/yii2-sitemanager": "*"

to the require section of your composer.json file.

Add the component to your common config:

...
'components' => [
    // ...
    'settings' => [
        'class' => 'koperdog\yii2sitemanager\components\Settings',
    ],
    // ...
]
... 

also you should add component to bootstrap config:

...
'bootstrap' => ['settings'],
...

and add the module to backend config:

'modules' => [
    'manager' => [
        'class' => 'koperdog\yii2sitemanager\Module',
    ],
],

Then start the migration (console):

php yii migrate --migrationPath=@vendor/koperdog/yii2-sitemanager/migrations

Usage

Once the extension is installed, simply use it in your code by :

autoloaded settings:

\Yii::$app->params['setting_name'];

If you are not sure if the setting is autoload:

\Yii::$app->settings->get('setting_name');
CRUD and URL config

CRUD settings:

go to /manager

CRUD domains:

go to /manager/domains

CRUD languages:

go to /manager/languages

also, if you want use standart CRUD, you can add to Url rule config:

// ...
'rules' => [
    'manager' => 'manager/default/index',
    'manager/<controller:domains|languages>/<action:\w+>' => 'manager/<controller>/<action>',
    'manager/<controller:domains|languages>' => 'manager/<controller>/index',
    'manager/<action:\w+>' => 'manager/default/<action>',
],
// ...