IDE Features
1. Syntax highlighting
Good syntax highlighting improves code readability a lot. Really! Just look at this:
2. Code completion
Automatic code suggestions can help the developer avoid having to type so much. If it supports custom classes and phpDoc, it can even save you from having to read project documentation.
Good code completion can also prevent typos. For example, if typing $cotroller-> does not show you any suggestions, you’ll know something is wrong. Uh oh… it should be $controller!
Poor code completion can slow you down if too many variants are shown or your class methods are not picked up.
It is also good to have file name completion in HTML src=" and PHP include and require.
3. Navigation
One of the most boring things is trying to find where a certain variable has been defined or used. Some good IDEs can help with “GoTo” actions, like go to definition.
Another important feature is search. Searching should not take a long time, even with large projects. Even better is if the IDE lets you move quickly to the next occurrence of a search phrase, like Firefox does with its Quick Find feature.
4. Errors and warnings highlighting
On-the-fly syntax checking can prevent various typos and common programming mistakes. In the example below, the IDE indicates that you may have used = instead of ==:
The more the IDE detects, the better — except false positives, of course.
5. Refactoring and code generation
Refactoring is basically a set of techniques for turning weak code into solid code. Its implementation in PHP IDEs is very weak compared to that of compiled-language IDEs, such as Java and C, but it’s still very useful.
Very basic PHP refactoring includes:
- “Move,” which updates all includes and requires when moving a file to another directory.
- “Rename,” which renames something and ensures it is renamed throughout the project.
- “Safe delete,” which ensures deletion of a file does not harm other parts of the project.
In addition to basic refactoring, some IDEs can generate code for class constructors, getters/setters and even stub methods for a parent class.
6. Debugging
Debugging is not so critical in PHP because you can add echos or use something like FirePHP without even having to recompile your code. But for complex applications in which you need to add echo after each line to see what’s going on, debugging can save you hours.
If the IDE is good enough, it provides you with step-by-step debugging and lets you see the current values of variables in scope.
7. Versioning system
Versioning is extremely useful for both team and one-person development. It shows what changes have been made to a file, when they were made and by whom. A good IDE allows you to visually compare revisions, copy changes from one version to another, revert to previous states and merge changes made by different team members.
When performing common checks and commits, integrating a versioning system such as CVS, SVN, git or Mercurial in your IDE is usually much better than running a separate application.
8. Client-side features
Using PHP alone is very rare. CSS and JavaScript are almost always somewhere in your application. So, good code completion, highlighting, navigation and perhaps some refactoring would be just as beneficial for the other languages and technologies you use in conjunction with PHP.
How To Choose A Good One?
Every IDE provides a lot of features. Some of those features are very useful, some are not. Here are some guidelines to follow to narrow down the one for you:
- Try free ones first. Their feature set may be enough for you, and you wouldn’t need to pay for a license.
- First, make sure the features you want are ones you really need. If they are, check that they work properly in your IDE of choice.
- If you find one IDE that fits well but is missing one or two features, try specialized tools.
- Once you choose an IDE, play with it for a week before implementing it in a big project. You may find your current working habits are too strong to allow you to feel comfortable with it.
A Comparison Table
What Was Covered
PDT, Zend Studio 6, Aptana PHP and Aptana Studio Pro are built on the
NetBeans
NetBeans is the new bright kid on the block, but not built on the
Development of this IDE is very public, open and rapid. Following the development blog and testing new builds as they come out is very interesting, even if there is already a stable version available (v6.5).
What Was Not Covered
There are plenty of powerful notepads such as PSPad, Notepad++, TextMate, vim and Emacs. Some are very similar to IDEs and even better if you want a good text editor but not the full IDE experience. Reviewing all of the good IDEs out there would not be possible (there are so many), so only the major players are compared here.
PHP IDEs We Tested
Here is the list of PHP IDEs:
- PDT 1
- PDT 2.0
- Zend Studio 6
- NetBeans 6.5
- NetBeans 7 (development version)
- Aptana PHP
- Aptana Studio Pro
- Codelobster *
- Nusphere PhpED 5.6 *
We thought it would be interesting to allow our readers to edit the table, which is hosted on Google Docs. Feel free to add your favorite IDE if it’s not there, or note some features on the ones that are.
Conclusion
Still not using IDE? You may be wasting time. Try it. You’ll see the difference.
Both PDT and NetBeans are good. If you need a lot of plug-ins, Eclipse is the better choice. If editing tools and code completion are more important to you, then pick NetBeans. NetBeans is a bit more responsive, too.
If you are mostly editing HTML and CSS, try Notepad++, vim, TextMate or Emacs. They all have very good HTML editing capabilities and can be configured for simple code completion. And they are faster and lighter than fully featured IDEs.
If you are editing complex JavaScript, try Aptana, which is amazing for JavaScript, or the Spket plug-in for Eclipse, which has nearly the same features.
And remember, IDEs are not meant to change the way you think. They simply speed up the development process.
Commercial vs. Freeware
Strange as it may sound, commercial PHP IDEs such as Zend Studio and Aptana Studio Pro do not have significantly more advantages than free alternatives such as PDT2.0 and NetBeans, both of which are very good.
With Aptana Studio Pro, you get a good IE JavaScript debugger, SFTP, FTPS and some other less-than-useful features for $99.
Like NetBeans, Zend Studio offers a bit more code completion and error detection than PDT. It also has a very good customizable code formatter, refactoring capabilities (which NetBeans also has) and some wizards for the Zend Framework. It starts at $399.
PHP IDE Resources
- PDT Project
Official Eclipse PHP Development Tools website. - Zend Studio
Official Zend Studio website. - NetBeans
Official NetBeans website. - NetBeans for PHP weblog
Here you can learn about new features to be included in upcoming releases and discuss them as they are being developed. - Aptana
Official Aptana website.
Subscribe to post feed