Cakephp 插件 3.7

Plugin cakephp 3.7

如何通过远程文件夹将插件映射到 cakephp 3.7?

在 3.4 版之后我不再能够加载插件,我查看了文档并检查它是否已经尝试使用 Application::addplugin ();和应用程序:: bootstrap ();这是我在搜索时找到的解决方案,我不知道是否需要执行更多步骤或者其他语法是否已更改。

来自 CakePHP 文档:

The plugin shell allows you to load and unload plugins via the command prompt. If you need help, run:

bin/cake plugin --help

Loading Plugins

Via the Load task you are able to load plugins in your config/bootstrap.php. You can do this by running:

bin/cake plugin load MyPlugin

This will add the following to your src/Application.php:

// In the bootstrap method add:
$this->addPlugin('MyPlugin');

// Prior to 3.6, add the following to config/bootstrap.php
Plugin::load('MyPlugin');

如果您在 bootstrap 中的任何方法/事件之前需要插件,那么请使用:

class Application extends BaseApplication
    {
        /**
         * {@inheritDoc}
         */
        public function bootstrap()
        {
            $this->addPlugin('OAuthServer', ['routes' => true]);

            // Call parent to load bootstrap from files.
            parent::bootstrap();

            if (PHP_SAPI === 'cli') {
                try {
                    $this->addPlugin('Bake');
                } catch (MissingPluginException $e) {
                    // Do not halt if the plugin is missing
                }

                $this->addPlugin('Migrations');
            }

            /*
             * Only try to load DebugKit in development mode
             * Debug Kit should not be installed on a production system
             */
            if (Configure::read('debug')) {
                $this->addPlugin(\DebugKit\Plugin::class);
            }

            // Other plugins
            $this->addPlugin('BootstrapUI');
            $this->addPlugin('Search');

阅读更多:

https://book.cakephp.org/3.0/en/console-and-shells/plugin-shell.html