panix / mod-plugins
Module plugins
Installs: 246
Dependents: 5
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:pixelion-module
Requires
- bower-asset/jsoneditor: ~3.1
This package is auto-updated.
Last update: 2024-10-18 18:27:19 UTC
README
mod-plugins is designed to work out of the box. It means that installation requires minimal steps. Only one configuration step should be taken and you are ready to have plugin system on your Yii2 website.
1. Download
mod-plugins can be installed using composer. Run following command to download and install mod-plugins:
composer require "panix/mod-plugins": "*"
2. 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,
add in our console config namespace migration - more here
return [ 'controllerMap' => [ 'migrate' => [ 'class' => 'panix\engine\console\controllers\MigrateController', 'migrationNamespaces' => [ ... 'panix\mod\plugins\migrations' ], ], ], ];
and run the following command:
$ php yii migrate
3. Configure application
Let's start with defining module in @app/config/main.php
:
'modules' => [ 'plugins' => [ 'class' => 'panix\mod\plugins\Module', 'pluginsDir'=>[ '@panix/mod/plugins/core', // default dir with core plugins // '@common/plugins', // dir with our plugins ] ], ],
That's all, now you have module installed and configured in advanced template.
Next, open @app/config/main.php
and add following:
... 'bootstrap' => ['log', 'plugins'], ... 'components' => [ 'plugins' => [ 'class' => panix\mod\plugins\components\PluginsManager::class, 'appId' => panix\mod\plugins\BasePlugin::APP_WEB, // by default 'enablePlugins' => true, 'shortcodesParse' => true, 'shortcodesIgnoreBlocks' => [ '<pre[^>]*>' => '<\/pre>', //'<div class="content[^>]*>' => '<\/div>', ] ], 'view' => [ 'class' => panix\mod\plugins\components\View::class, ] ... ]
Also do the same thing with
@backend/config/main.php
@console/config/main.php
@api/config/main.php
- our modules
- etc...
... 'bootstrap' => ['log', 'plugins'], ... 'components' => [ 'plugins' => [ 'class' => panix\mod\plugins\components\PluginsManager::class, 'appId' => panix\mod\plugins\BasePlugin::APP_BACKEND ], 'view' => [ 'class' => panix\mod\plugins\components\View::class, ] ... ]
Base AppId panix\mod\plugins\BasePlugin::
- const APP_WEB = 1;
- const APP_BACKEND = 2;
- const APP_COMMON = 3;
- const APP_API = 4;
- const APP_CONSOLE = 5;
Core plugins (examples)
Your plugins
Автор & License
- Автор LoveOrigami
- License
Модуль был взят у автор и под корректирован под Pixelion CMS