A little preface…
I was doing PHP for about 9 years, until I switched to JAVA last year for a breath of fresh air. I was just curious how they do things… So generally I was writing crappy code for a pretty long time. I switched between tons of IDEs, cursed and sweared most of them using pretty ugly and stinky words. My last year was under the motto “How could they charge for IntelliJ IDEA license”, but that’s another story. During that period I started looking for a best IDE for PHP having only one requirement: I WANT IT FREE.
Disclaimer: those of you who mention Emacs, vi or any derivative, will be banned by IP. Seriously. Geeky times where you should be the only one that can run your editor are OVER. There are many editors that support PHP syntax highlighting but those won’t be considered either. Notepad++, being my best-choice notepad app, is not an IDE.
From the paid editors I have only used Zend studio and it is pretty good one. If you would spare $300-500 it will pay off, but I personally would buy it only if I have some corporate money for that.
In general if you’re ready to go and experiment, a good start (and a main information source) is this page in Wikipedia.
An IDE should be able to:
- color your code
- analyze code and suggest you with proper auto-complete
- debug your code
- help you mange your versioning systems
Here I will have a look at NetBeans and Eclipse with PHP Development Tools, and will try to outline my likes and dislikes about them. I tested these IDEs for about a month trying them during my get-to-know hours with the Symfony and Zend Frameworks. Both are complex enough to need a powerful IDE for you to work well… so…
My first editor of choice was NetBeans. A lot of my fellow-coders used it and they’re pretty satisfied with it, so I gave it a try.
NetBeans has also a built-in SVN support, which will make you start coding in just a couple of minutes. You can directly checkout project from SVN and start breaking it.
NB supports all king of neat PHP features as function params suggestions, class look-ups and all the goodies you need. There is even a setting that tells if you point to a class, whether the full path of the class should be used or you want just the name (reference to the namespaces in the latest PHP versions). What I did not like about the NetBeans was that there is currently no support of the USE directive in PHP. Once you try to extend a class with another one, you have to add the “use \Symfony\Security\Bundle\SecurityManager” code at the top by yourself, while Eclpse+PDT managed did not have this problem.
Coloring of the code is a good part of NB. You can customize any color as you like. There is even tons of color themes around the net, for example here, which you can import directly in the colors tab in the Settings window.
Debugging is very easy with Xdebug, which is pretty well integrated into the environment. What I liked is that once you enter a debug session, nothing in the IDE changes, only the watches show in a toolbox. You can jump, run into, step over and resume with ease. The problem is with the abscence of complex conditional breaks and stuff like that.
So my bottomline is
- Simple interface
- Built-in support for SVN
- Built-in color syntax highlighting for PHP, CSS, HTML, JS and etc
- Decent function and class lookup
- Simple debug interface
- Some class completions are lacking support for latest PHP stuff
- Sometimes code-completion messes up and cant guess return value types
Eclipse is a platform for developing platforms. It has a basic interface which you can extend in unlimited ways. Problem here is that you have to configure your environment all by yourself.
Installation here is a little tricky. You go to the PDT eclipse site and you’re offered a whole package of Eclipse with built-in PDT plugin (this redirects to the ZEND site). As an alternative you can add PDT to an existing Eclipse installation you have. The result is an archive file that you extract and start using.
All is good so far, if you don’t want to use SVN, because there is no built-in support for it (CVS ?!? only). So you have to add the current repository of the eclipse and manually add Subversive plugin and one or several connectors for it.
In Eclipse you can have both 1.6 and 1.7 SVN projects, which is pretty neat. You can checkout a repo and then convert it to any project type you want.
The coloring of the source is perfect. Several color themes are available around the net, through settings import. The IDE interface is a little rubish, at least from my tower. Too rounded and too much empty space between items.
And here comes the horror – perspectives. You use a perspective (a separate set of toolbars and screens) for each language you use JAVA or PHP or whatever else. There is even a different DEBUG perspective. This could be both good and bad, but for me it was not a big feature as I don’t like to spend my time in configuring.
Code completion is outstanding in Eclipse. While I was trying out Zend Framework this bloody thing even recognized that I write a path to a class inside a string (for one of the service managers) and started autocompleting it for me. Perfect recognition of comment directives and return types. Also a great impression came to me that when you extend a class, it adds the USE statements by itself and saves you loads of stupid scrolling, which was great.
Debugging in Eclipse is a little tricky. Although here you can use either XDebug or Zend Debugger (as Zend contribute big time to this PDT), you go to a separate perspective where you get a bunch of toolbars opened (one of them even allowing you conditional breaks and stuff) but you loose 60% of your screen. Then to go back to the source editing you have to switch back. This sincirely anoyed me.
In general Eclipse+PDT is a great and powerful choice if you’re ready to spend some time configuring and setting it up. The availability of many plugins allows you to do magic, but also allows you to mess your environment pretty well, so bare it in mind. Powerful IDE with loads of code analysis inside.
- Powerful IDE
- Modular plugins system allowing great extensibility
- Great code look-up and debug options
- overly complicated functionality
- not that good user interface utilisation.
- fewer built-in functionalities
- heavy on system resources, more clumsy than the other
- Actually quite strange initial key-mapping (even Ctrl+Tab was to be manually configured)
Final words are never final, you know. I continue to use both on my DEV environments and can’t speak in favour of one of them.
NB is fast and lightweight and quite powerful, lacking only some high-end/latest fashion features, while providing great usability. Eclipse, on the other hand, is really ugly but provides may be the best tools and code-look up, on the price of numerous configurations and plug-ins management, which can be disgusting. Both IDEs support versioning of files, supporting local histories too.
Chose your IDE as you try them in real life. Don’t belive me 🙂 Both are good and as all articles finish “It is all a matter of personal preferrence”
Comments are greatly appreciated.