17

I am using Netbeans IDE for Php development. It gives me code completion for Kohana framework. Is there any way to have code completion for CodeIgniter in Netbeans?

tereško
  • 58,060
  • 25
  • 98
  • 150
baig772
  • 3,404
  • 11
  • 48
  • 93
  • 1
    possible duplicate of [How to integrate codeIgniter with netbeans fully](http://stackoverflow.com/questions/9308604/how-to-integrate-codeigniter-with-netbeans-fully) – Colin Brock Aug 01 '12 at 19:13
  • Possible duplicate of [How to integrate codeIgniter with netbeans fully](http://stackoverflow.com/questions/9308604/how-to-integrate-codeigniter-with-netbeans-fully) – jjj Feb 17 '17 at 11:46

1 Answers1

38

Instructions:

Create a new directory inside nbproject (I used this since it’s omitted when pushing to prod) with your name of choice, I used CI_Autocomplete.

Create a new file with your name of choice, I used CI_Autocomplete_2.0.php, and place it inside the newly created folder, nbproject\CI_Autocomplete.

Paste the below code inside the new file, CI_Autocomplete_2.0.php.

<?php
    /**
    * @property CI_DB_active_record $db
    * @property CI_DB_forge $dbforge
    * @property CI_Benchmark $benchmark
    * @property CI_Calendar $calendar
    * @property CI_Cart $cart
    * @property CI_Config $config
    * @property CI_Controller $controller
    * @property CI_Email $email
    * @property CI_Encrypt $encrypt
    * @property CI_Exceptions $exceptions
    * @property CI_Form_validation $form_validation
    * @property CI_Ftp $ftp
    * @property CI_Hooks $hooks
    * @property CI_Image_lib $image_lib
    * @property CI_Input $input
    * @property CI_Language $language
    * @property CI_Loader $load
    * @property CI_Log $log
    * @property CI_Model $model
    * @property CI_Output $output
    * @property CI_Pagination $pagination
    * @property CI_Parser $parser
    * @property CI_Profiler $profiler
    * @property CI_Router $router
    * @property CI_Session $session
    * @property CI_Sha1 $sha1
    * @property CI_Table $table
    * @property CI_Trackback $trackback
    * @property CI_Typography $typography
    * @property CI_Unit_test $unit_test
    * @property CI_Upload $upload
    * @property CI_URI $uri
    * @property CI_User_agent $user_agent
    * @property CI_Validation $validation
    * @property CI_Xmlrpc $xmlrpc
    * @property CI_Xmlrpcs $xmlrpcs
    * @property CI_Zip $zip
    */

    class CI_Controller {};

    /**
    * @property CI_DB_active_record $db
    * @property CI_DB_forge $dbforge
    * @property CI_Config $config
    * @property CI_Loader $load
    * @property CI_Session $session
    */

    class CI_Model {};
?>

Now go to (this is for OSX so not sure if it’s the same for Windows) File > Project Properties (projectname) > PHP Include Path and include the new folder you created above, nbproject\CI_Autocomplete.

Restart your project and autocomplete will work.

yAnTar
  • 4,269
  • 9
  • 47
  • 73
  • 2
    My NetBeans whould not allow me to include a project path that is inside the "nbproject" path. Used a seperate folder outside a project, and everything works fine! – ZoltanF Nov 12 '12 at 10:15
  • @ZoltanF, no need to create another folder outside the project. Just create create folder and php file as specified in the answer. It works fine. NetBeans IDE 7.2.1 in Windows XP SP3 :) – Mansoorkhan Cherupuzha Jan 22 '13 at 11:31
  • How can I do the same for view files? This doesn't give autocomplete inside view files. – Tool Apr 07 '15 at 12:38
  • @Tool - http://stackoverflow.com/a/27978177/1221313 - here is example for view filew - you should use phpDoc. – yAnTar Apr 14 '15 at 09:32