Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,我问下我自己写的yaf插件的路径能不能改变下,不要放在application下 #554

Open
yegaomin opened this issue Aug 23, 2021 · 1 comment

Comments

@yegaomin
Copy link

我目前是放在application的plugins里面,但我想另外放个别的地方,请问如何做到?

@yunx-lee
Copy link

我目前是放在application的plugins里面,但我想另外放个别的地方,请问如何做到?

自己写的plugin可以放在任何地方,只要你能正常加载和实例化,只是yaf会判断 className后缀为Plugin,
就会去application/plugins下找,如果你想放到其他地方,比如你自己开发了一个插件 \path\to\namespace\logger,
并发布到composer,那在正确include 了 composer autoload.php文件后,在Bootstrap.php中可以像下面这样用:

use path\to\namespace\logger;

class Bootstrap extends \Yaf\Bootstrap_Abstract {

    public function _initLogger($dispatcher) {
        $dispatcher->registerPlugin(new logger());
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants