CodeIgniter auto complete with Netbeans
September 1st, 2009I had been longing for code completion for CodeIgniter with NetBeans for a long time. Finally got a very simple solution which I tested with NetBeans 6.7. It works for
- All CodeIgniter system libraries
- Own model functions
- Own library functions
- Helper functions
Basic Autocomplete :
To get autocomplete feature for basic CodeIgniter(1.7) functions ONLY just download this file(ci_autocomplete.php) and copy it in your netbeans project directory nbproject.
Advanced autocomplete:
For more advanced autocomplete feature like getting the list of model functions, your own library functions, you need to add
@property Your_Model $model_object_name
in the file ci_autocomplete.php( that you copied in nbproject). For example :
* @property Buyer_Model $buyer_model
Then in any controller if you write $this -> buyer_model -> …. the functions list will automatically popup.
Finally, to make every thing simple I just have written a simple script(autocomplete_script.php), can download from here, that will automatically traverse all the system libraries, your application libraries and models directory and list all class names. What you need is to
- Run the script
- Copy whole output
- Paste it in a file and keep it in nbproject
Limitations:
- If you extend a library like MY_DB_mysql_driver it does not work
- You have to run my script(autocomplete_script.php autocomplete function) from a codeigniter controller
- In my script(autocomplete_script.php) I assumed that model file name and class name same and all has _model as suffix(user_model, buyer_model) etc
Edit:
To make everything available for Models just need to add some properties after the Controller class in same fashion. I have updated my ci_autocomplete.php file accordingly. To see how all things work together you can see my autocomplete_all.php in the zip file.
For Helpers autocomplete:
You should automatically get the hint for helper functions available in your project. If you don’t get the hint then try tools -> options -> php -> Global Include Path -> add Folder -> your_system_folder.
Thats all !
Happy Coding with NetBeans and CodeIgniter ![]()


