Correcting code completion in NetBeans
General code completion in NetBeans works quite good (expect for its speed), but since NetBeans was made for Java and has only “added” support for PHP then it has some issues code completion for PHP and for coding in Yii framework it fails nearly completely.
Here you’ll find approach to fix this and make Yii developers using Netbeans life a little bit easier.
Add Yii to project directory
First step is to include Yii folder (if it is outside project directory) in your project. You can achieve this in
File > Project properties > PHP Include Path, by adding the Yii framework root path.
- Yii is your primary framework, so
- you keep framework folder in separate folder outside project directory (as above) and
- you are creating many projects
then adding the Yii path to every project can be tedious. In this case Yii path can be added to the “global include path” so that it’s automatically included for every old and new projects.
You can do this in
Tools > Options > PHP, by adding Yii path to the
Global include path list.
This is to to avoid doubled or missing documentation
Tools > Options > Miscellaneous > Files,
- add in
Files Ignored by the IDEthe
yiilite.phpfile (it must be added to the front, so string in this field should starts with
^(yiilite.php|CVS|SCCS|after this change),
- restart NetBeans.
After that quick documentation for methods should be correctly displayed and they should be displayed only once (i.e. comming from main framework folder and not from ignored
I’m not using PHPUnit (mainly due to small scale of my project and the fact that properly configuring it is quite hard task). If you want to use it, then these articles may be a good starting point for you:
- Tips about setting up testing environment with PHPUnit and Selenium.
- More details on manual installation of PHPUnit.
Especially the second one seems as very usable, as automated installation via PEAR fails most of the time.