2017 © Pedro Peláez
 

yii2-extension yii2-plugins-system

Plugins system as WP for Yii2

image

loveorigami/yii2-plugins-system

Plugins system as WP for Yii2

  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 19 Forks
  • 2 Open issues
  • 8 Versions
  • 13 % Grown

The README.md

Getting started with Yii2-plugins-system

Latest Stable Version Total Downloads License, (*1)

Yii2-plugins-system 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., (*2)

"Plugins", (*3)

1. Download

Yii2-plugins-system can be installed using composer. Run following command to download and install Yii2-plugins-system:, (*4)

composer require "loveorigami/yii2-plugins-system": ">=3.*"

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, (*5)

return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                 ...
                'lo\plugins\migrations'
            ],
        ],
    ],
];

and run the following command:, (*6)

$ php yii migrate

3. Configure application

Let's start with defining module in @backend/config/main.php:, (*7)

'modules' => [
    'plugins' => [
        'class' => 'lo\plugins\Module',
        'pluginsDir'=>[
            '@lo/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., (*8)

Next, open @frontend/config/main.php and add following:, (*9)

...
'bootstrap' => ['log', 'plugins'],
...
'components' => [
    'plugins' => [
        'class' => lo\plugins\components\PluginsManager::class,
        'appId' => 1 // lo\plugins\BasePlugin::APP_FRONTEND,
        // by default
        'enablePlugins' => true,
        'shortcodesParse' => true,
        'shortcodesIgnoreBlocks' => [
            '<pre[^>]*>' => '<\/pre>',
            //'<div class="content[^>]*>' => '<\/div>',
        ]
    ],
    'view' => [
        'class' => lo\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..., (*10)

...
'bootstrap' => ['log', 'plugins'],
...
'components' => [
    'plugins' => [
        'class' => lo\plugins\components\PluginsManager::class,
        'appId' => 2 // lo\plugins\BasePlugin::APP_BACKEND or our appId
    ],
    'view' => [
        'class' => lo\plugins\components\View::class,
    ]
    ...
]

Base AppId lo\plugins\BasePlugin::

  • const APP_FRONTEND = 1;
  • const APP_BACKEND = 2;
  • const APP_COMMON = 3;
  • const APP_API = 4;
  • const APP_CONSOLE = 5;

Shortcodes

Core plugins (examples)

Your plugins

Contributing to this project

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing., (*11)

License

Yii2-plugins-system is released under the MIT License. See the bundled LICENSE.md for details., (*12)

The Versions

23/10 2017

dev-master

9999999-dev

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin

10/10 2017

3.1.4

3.1.4.0

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin

05/02 2017

3.1.2

3.1.2.0

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin

04/02 2017

3.1.1

3.1.1.0

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin

19/01 2017

3.0.0

3.0.0.0

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin

17/06 2016

2.0

2.0.0.0

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin

18/08 2015

1.0

1.0.0.0

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin

02/08 2015

1.0-rc

1.0.0.0-RC

Plugins system as WP for Yii2

  Sources   Download

MIT

The Requires

 

plugin yii2 event yii2-plugin