Kostas Livieratos
Kostas Livieratos

Reputation: 1067

How to use correctly a CakePHP plugin

I've developed a bug tracker using CakePHP 2.4.4. I made this as a standalone cakephp app but now I wanna transfer it to a plugin, in order to reuse it in other projects. As I already read at the docs (http://book.cakephp.org/2.0/en/plugins.html), I have followed the instructions from there and created the correct folder and files structure. This is what i've done so far: https://github.com/lubbleup/BugCake/tree/plugin

But now,when i try to use the plugin in a separate cakephp installation, I cannot understand how to make of the plugin and, for example, use it's controllers and functionality etc.

can anyone help me out here?

ps:this is my first time trying to create a cakephp plugin

Thank you in advance!

Upvotes: 0

Views: 1972

Answers (1)

Jan
Jan

Reputation: 1221

You have to load the plugins your parent app in APP/Config/bootstrap.php

CakePlugin::loadAll();

You do not need AppModel or AppController in your plugin. Your plugin has an own AppController/-Model named PluginNameAppController/PluginNameAppModel.

You can call your plugin at http://host/plugin_name/controller/action/[...]. In your case http://host/bug_cake/issues/view/1 for instance.

But you can also use custom routes in your plugin with plenty of options.

Hope that answers your question—if not, comment.

Upvotes: 1

Related Questions