CakePHP auto-complete in NetBeans

Most annoying thing, while coding projects using CakePHP framework in NetBeans is lack of auto-complete feature for models and components in controllers. You can find some solutions that help avoid this problem like adding to each controller new variables and special phpDoc or adding @property to class phpDoc. In my opinion second option is easier, as it do not require to change code of class itself. So I could add manually this tags to each class. But as a programmer I’m lazy person. So I create this simple tool, which add necessary phpDoc properties to code of each controller, model, component and behavior.

How to use it?
First you have to install python on your machine. Then you have to download two files: caker.py and propertier.py and save them in one directory. Then open command line and type something like that:

caker.py -n ProjectName -d your/project/app -a

It will automatically add all properties to your code. Also it will add @package and @subpackage property (this is for generating better documentation using phpDoc).

If you prefer to add properties to single file you can type:

caker.py -n ProjectName -f controllers/user_controller.php -c

Other command line options:

  • -n ProjectName – name of project (used for generating @package)
  • -d directory – directory with cake project
  • -f fileName – single file to scan
  • -a – scan for controllers, models, components and behaviors
  • -c scan only controllers
  • -m scan only models
  • -o scan only components
  • -b scan only behaviors

Script in action:

Download current version of CakePHP AutoComplete