Why use an IDE for PHP Development
In the great debate Text editor vs IDE I am a strong supporter of the IDE corner. I strongly feel that having a full featured development environment is an important tool in the arsenal of every developer. Text editors have a lot to offer but there a lot of things that can be achieved only through the use of plugins. Let’s take a look at some of the most important features that IDEs have to offer.
1. SYNTAX HIGHLIGHTING
Syntax highlighting is essential, as it improves the readability of our source code. This is something that both text editors and IDEs have pretty much down so I am not going to expand on this.
Most text editors however do not support on-the-fly syntax checking which can prevent various typos and common programming mistakes. For example most IDEs will warn you that you are using = instead of == in an if statement.
2. CODE COMPLETION
Code suggestions is very important for me. It boosts my productivity and speeds up my code writing. A lot of IDEs also support code completion for documentation such as PHPDoc which is a definite plus.
Code completion prevent typos. A lot of times we have silly typos in our source code that take forever to debug, especially in PHP which does not require variables to be declared before using them. By using auto completion we make sure that the variables names are inputted correctly.
A very important feature that a good IDE should have is code navigation. It is a very tedious task to constantly search for the declaration of a class/method or search for every usage of any given method. Even if you know in which file exactly the declaration is, having to manually open the file takes time and it’s tiresome. With an IDE you can “jump” to a declaration or find every instance of a class in the project with only a couple of clicks.
Moreover when searching for something in an IDE you can specify what kind of resource you are looking for, so it’s much more than a simple string search and it’s a lot faster too.
The single most important feature that wins the debate for me is debugging. Decent IDEs for PHP enable you to debug your code step by step, have watch variables, expressions and pretty much everything that you would expect from a debugging environment. To be perfectly honest in takes a little bit to set it up properly but once you do, it’s a game changer. You no longer need to rely on echo and var_dump to debug, you can stop the execution any time, at any point you want, you can change your code at runtime. It’s just beautiful and astounding in term of productivity boosting, especially if you are sporting a dual monitor setup.
IDE for PHP development
For me the absolute best IDE for PHP is PhpStorm by JetBrains (€89). It is fast, it has all of the above features and many, many more. I am going to list a few that I find amazing, but I urge everyone to download the trial and see for themselves
- Frameworks Support (Symfony2 & Yii frameworks)
- Callback references
- Smarty Templates editing
- PHP Refactoring (including Smart Duplicated Code Detector)
- Unit Testing with PhpUnit
- VCSs Integration (Subversion, Mercurial, Git, Perforce, CVS, and TFS)
- Databases & SQL integrated studio
- Integration with Issue Trackers (JetBrains YouTrack, Atlassian JIRA, Lighthouse, Pivotal Tracker, GitHub, Redmine, and Trac)
If on the other hand you can’t afford a commercial product, I strongly recommend Eclipse PDT which is a PHP optimized version of Eclipse. It covers all the features that I wrote about and a lot of others. It feels a little sluggish but overall it’s great. It is also noteworthy that you can extend Eclipse through the use of plugins (the official repository has a lot of them) and get ftp/svn/database integration.