NetBeans 6.5 review


During the weekend, I tried out NetBeans 6.5 and its new PHP related functionality. I had earlier seen some quick shots of how the support was, and it seemed like a good contender for big names like Zend Studio.

What features does NetBeans 6.5 have for PHP developers? How does it compare against Zend Studio for Eclipse?


At the general level, NetBeans is quite similar to most other IDEs: You get a project view on the left, an outline of the things in the current file under that, an editor on the right and a task/problem view below the editor. It does all the usual tricks you’d expect, like tabs in the editor, syntax highlight, PHP function code assist etc.

Other PHP related functionality it provides are things such as templates – when you type func, it can autocomplete an empty function for you, fast PHPDocumentor docblock comment creation, code-assist for custom PHP classes based on the docblocks, including what variables their methods take etc.

NetBeans also has refactoring support for PHP – something that I’ve only seen before in Zend Studio. For example, you can easily rename a variable or a method in your class, so that it gets renamed everywhere in your code where it’s used.

In depth

The PHP editor

This is of course the most important part. Zend Studio for Eclipse has a very good PHP editor, and other IDEs with PHP support that I’ve tried (such as Komodo) usually fall very far from it.

NetBeans, however, does about 95% of what Zend Studio does.

  • Code-assist for builtin PHP functions? Yep.
  • Code-assist for custom functions and classes? Yep.
  • Quick insertion of phpdoc blocks? Yep.
  • Displays phpdoc information in code-assist? Yep.
  • Does above for variables, methods, methods’ parameters and all? Yep.
  • Let’s you easily rename variables/methods/classes with a refactoring tool? Yep.
  • Supports snippets/templates for quick inserting of function/class stubs etc.? Yep.
  • Supports code folding? Yep.
  • Supports jumping to the declaration of a variable/method/class? Yep.

Did I forget anything? Feel free to point it out!

NetBeans even does some of the things better than Zend Studio – which is definitely an achievement.

PHP code-assist in NetBeans
php code assist in NetBeans
Click for bigger image

For example, the code-assist for builtins displays more information, and links to PHP manual. The code folding feature (ie. those little + signs that you can use to make funcs and comment blocks smaller) works reliably, unlike in Zend Studio where it can screw up and display your code totally wrong if you use the folding feature, which is luckily only a rendering glitch.

NetBeans’ PHP documentor support is very good as well. For example, it supports the @property declaration that isn’t supported by Zend Studio. This is useful for example when you work with Doctrine 1.1, as it generates those for your models to give code-assist for the model properties.

But while NetBeans gives you @property, its support for @return is a bit shaky. It works just fine as long as you have a single return value, ie. @return Zend_Layout, but it screws up when there’s more, like @return Zend_Layout|null, which is valid phpdoc and means it would return either an instance of Zend_Layout or null. In the latter case, NetBeans won’t give you any code-assist at all. I have filed a bug report for this, so hopefully it’ll be fixed in a future release.

The project view

The project view does a decent job of letting you go through the files and directories in your project with ease. It will also display little icons and color changes, if you’re using subversion, to indicate modified files and such.

While it’s otherwise good, I do have a minor gripe in regards to creating new items. If you hit Ctrl+N in Zend Studio to create a new item, you can simply type in “folder”, “file” or “php file” etc. and hit enter and be done with it. In NetBeans, you need to first choose the correct main “group” of items, then hit tab and choose one of the file types (or mouse click) and hit enter. For some weird reason, if you doubleclick one of the items with the mouse, nothing will happen, and you will need to click next.

So if you’re really used to the way Eclipse based IDEs handle creation of new files and dirs, this may initially be a small annoyance, but it still works okay after you get used to tabbing around the selections.

PHP debugging support

While I haven’t used this much yet, it exists and seems to work as you’d expect with functionality like setting breakpoints, stepping through code and viewing variable values. NetBeans’ debugger appears to work with XDebug instead of the Zend Debugger module you will require to use Zend Studio’s debugging features.

+1: NetBeans debugger immediately worked with the xampp installation I had on my PC. The installer already picked up my apache from there, and when I fired up the debugger, it worked seamlessly. Getting Zend Studio’s debugger up and running was a bit more of a hassle, and I actually needed to consult Google for that.

Version control support

NetBeans supports CVS, Subversion and Mercurial out of the box, but they may require an external download if you don’t have the correct client installed beforehand. The installation for those is automatic and relatively painless, though.

The svn support was a bit confusing as it did some things in a bit weird way, compared to what I had gotten used to with TortoiseSVN. However, it works rather well after you get to know the quirks.

Wait, there’s more

NetBeans does even more than that. It has better support for HTML, CSS, JavaScript and even formats like YAML.

HTML code-assist in NetBeans
php code assist in NetBeans
Click for bigger image

When editing HTML in Zend Studio, it sometimes lets you autocomplete the closing tag, and it does display a list of attributes for some tags like form. That’s pretty much all it does.

NetBeans HTML editor is great – it autocompletes closing tags, lists attributes, even displays details on what the attributes do. It displays a lot of information for tags, too.

It doesn’t do that just for HTML – that happens in CSS as well. You get good information on the properties, and options for the values. It also features a “style builder” and a preview which lets you see how your selected style would look. As an added bonus, it seems to handle cascading styles correctly, so if you define that the body has a black background and your h1 declaration says the font must be white and bold, the preview has a black background too.

While the detailed infoboxes on HTML and CSS may not be of use to everyone, it could save you a trip to the W3C CSS spec – I know I have had to look things up from there from time to time.

And you get all this for JavaScript too – code-assist, function explanations, even for custom functions and complex objects. Oh, and debugging support in Firefox or IE. The JavaScript assist can even understand the difference between static and nonstatic functions (or whatever their proper JS terminology is), has some support for JSDoc etc.


Why aren’t you downloading NetBeans yet?

With all these features, the minor flaws in it don’t really matter – and they will hopefully get ironed out in a new release.

Did I mention it’s free? Yep, it has more features than the commercial big name Zend Studio does, and it’s completely free.
I probably forgot to mention something, since it’s got so many features in it. There’s also support for SQL etc. but I haven’t looked into those yet.

NetBeans 6.5 is officially my new favorite PHP/web-dev IDE.

Further reading:
Vim user? You’ll love NetBeans