How to create new cakephp 3 plugin?


Anyone can guide me to create new cakephp 3 plugin?


Follow the docs

You can create plugin by specially two way.

  • Using cakebake

  • Creating plugin structure

For Cakebake you just need to run this code by you terminal “bin/cake bake plugin YourPluginName”.
It will do lots of work automatic like make the plugin sturcture , activate the plugin by changing on .phar file. In one word you don’t need to do any thing in your coding you just get a ready made plugin for use.

But if you want to make plugin by your own then you have to follow these process.

  1. Make this folder structure outside src.

  2. Change into config/bootstrap.php file

Plugin::load('YourPluginName', ['routes' => true]);


Plugin::loadAll(['routes' => true]);

  1. Chnage into plugins/YourPluginName/config/routes.php:.


use Cake\Routing\Route\DashedRoute;
use Cake\Routing\Router;

    ['path' => '/your-plugin-name'],
    function ($routes) {

It’s ready… :slight_smile: Now to access this plugin go to this link
// Access the index route of a plugin controller.

// Any action on a plugin controller.

thanks for your reply.

1 Like