Till recently I had been using my trusted editor, Notepad++, for doing all my development work. Not that I am not using it anymore, but I was looking for something more powerful and integrated, something like an IDE. I had tried few IDEs including Eclipse before but did not get much into it and hence left it there. I picked up Eclipse again and tried to give it one more try. I also tried out Aptana which is another awesome IDE built on Eclipse with all the web development tools you need built into it out-of-box (PHP, Ruby, jQuery, Python).
So, I started with downloading PHP Development Tools Project version of Eclipse (Eclipse PDT) as I was primarily going to use it for PHP development. Its a huge zip file but good thing is no need to install it, just unzip and run the exe. After setting up the initial workspace, PHP settings etc., we can start adding our projects and get onto development work.
Currently, the project I am working on is built using Code Igniter and was looking to develop using Eclipse. Adding a project was pretty straight forward but getting the auto completion to work was an issue. However, there is a workaround to get it all working.
First, we need to move the application folder out of the system folder and bring it up one level next to the system folder. So, it looks something like this :
application/ config/ controller/ errors/ .... system/ codeigniter/ database/ fonts/ ..... index.php .htaccess
Now, edit the index.php file in the root folder and change the following line :
$application_folder = "application"; to $application_folder = "../application";
Now, we can add the system and application folders as Eclipse project. First create a new project and name it something like “CI_CORE” which points to the system folder. Similarly, add another project “CI_APP” which points to the application folder. It should look something like the following image. Once, CI_APP is added, right click and modify the properties. Select PHP Include Path and add “CI_CORE” under Projects. And it’s done.
Now, to test out whether the auto completion feature works or not, create a new controller (news.php in my example) and add constructor method. Add any method and press Ctrl + Space to bring the auto completion window like the following image.