Since CakePHP 1.2beta the bake script supports the generation of plug-ins. This feature is a bit hidden in the current version, as it is not mentioned when you call the help of the bake script:
cake bake help
Anyway, its usage is quite straight-forward. With
cake bake plugin demo
you can generate the structure and the base files for a plug-in with the name “demo”. This actually creates the following structure and files in app/plugins:
demo controllers components models behaviors views helpers demo_app_controller.php demo_app_model.php
With
cake bake plugin demo controller cake bake plugin demo model cake bake plugin demo view
you can bake controllers, models, and views for the “demo” plug-in. The parameters you can use are the same as when baking “normal” controllers, models, and views, for example
cake bake plugin demo controller users
bakes a UsersController with var $scaffold set. See Faster baking of controllers with the bake shell script or Baking views for more details.
One thing you have to be aware of is that the generated controllers and models extend AppController resp. AppModel by default, and not the plug-in-specific versions, i.e. DemoAppController resp. DemoAppModel in the “demo” plug-in example. That means you have to manually change this if you want to make use of the plug-in-specific AppController resp. AppModel.
Happy baking :)
[…] To bake plugins, see here. […]