Benefits of NetBeans as Drupal IDE

This blog post is not an advertisement. Moreover, I must admit, I do not happen to be a big fan or Oracle. Having said that, I want to thank them for NetBeans, which happens to be my favorite Drupal IDE. In this post, I am not doing an overview of the NetBeans IDE - an overview can be found on its web site. What I hope to do here, however, is to show the top 10 benefits that make NetBeans the tool of choice for my Drupal development.

The screenshots I made are from NetBeans 7.3 beta. Still, most of that functionality bas been around for all 7.x releases.

1. Usable, Fast, Cross-platform

NetBeans IDE

For my Drupal development, I end up working in both Windows and Linux. I use Geany heavily for editing single files. But, when working with projects, there is a certain need for a tool that would allow to treat the project… well, as a project, rather than as a folder of unrelated files. I needed an IDE to manage the project, and allow refactoring and a project-wide search. And, nothing is as cool as having function name suggestions from Drupal core and from own code files across the project appear in a suggestion list. Or having the custom CSS colors appear as top suggestions in the CSS color suggestion list.

So, for me, the search for a good IDE (predictably) narrowed down to Eclipse and NetBeans, and, after I used both for about a year, I settled with the latter. NetBeans has a slick and functional interface, and is fast and cross-platform. I usually have my code base in one folder, and NetBeans loads it well and works well with that single code base from within different operating systems. A code window with tabs and a project explorer with the symbols list below is my standard work place setup.

2. Navigate, Format, Refactor

NetBeans IDE Goto and Refactor

Modern Drupal is a complex beast, with a huge and increasingly object-oriented API base, to which contrib modules add significantly. While there is an site, there is nothing as cool when studying some function usage, as right-clicking on its title and navigating to its initial declaration code.

Refactoring has become a given for every good IDE. NetBeans does it very well, allowing you to see the diff result of the changes that refactoring a function will cause across multiple project files. A very helpful tool to guard against bad naming choices.

You can do quite a few smart tricks with a complex Drupal project codebase in NetBeans.

3. Extensive language help and suggestions

NetBeans IDE Extensive language support

NetBeans has help and suggestions for code completions. For PHP, you see the list of functions after you type the first 3 letters. At this point, you can stop typing, and select the desired function from the list with your mouse, viewing the function's description and arguments in the popup as you single-click on the function name in the list. Double-click will insert that function into the code. One cool thing is that it will substitute the closest in text variable instead the default "needle" and "haystack", making quite a good guess most of the time.

Having a good suggestion and help system saves me a lot of time when I don't remember which arguments go in which order.

4. PHPDoc on the fly

PHPDoc on the fly

Now this is one of the things that absolutely bought me in for NetBeans. Imagine, that besides PHP, you also have a Drupal core, and some few dozen contrib modules, and some of your own. As you write code to integrate with them, you are spending hours at DrupalContrib, looking through these module's APIs. And what about your own modules with your own functions?

Now, if you are using PHPDoc format, which is standard for Drupal coding standards, NetBeans will parse these comments, and parse the function names in your project, and will display the function names, arguments, and the PHPDoc descriptions as suggestion and help, together with the standard PHP functions. There are no words to convey how handy that is!

5. Git support

Git support

This is not a big thing, really, but a very helpful one. You can pull, commit, push, from within NetBeans IDE. It interacts with your local Git binary, and can store passwords and interact with your remote sources as well. This functionality has only been working well since NetBeans 7.1. Doing an add, commit, pull and push in just a few clicks is quite nice and easy.

Besides, NetBeans Git plugin is context-dependent. If you click on a single file from the project explorer and add or commit, it will do so for only that file. When committing a directory, it will show the affected files list, allowing you to exclude the files that you don't want to be in that commit.

Not all of Git options are automated, but this is roughly the level of integration with Git I would want for an IDE.

6. XDebug support

XDebug support

There are a few free IDEs that support debugging. Eclipse does, after some tweaking. Komodo Edit's comparison chart proudly lists debugging as a point available only for a non-free Komopdo IDE version, so also does the JetBrains' PHPStorm.

In NetBeans, you can set break points and step through the code, and view the value of variables in run-time. Sometimes I wish the bubbles would have a collapsed hierarchy like devel's dpm() command. But I know of no IDE that would do that.

7. Symbols panel

Symbols panel

Most IDEs and even editors like Geany have a "symbols" panel that has function names for PHP and JavaScript, some basic HTML elements, and classes/IDs for CSS.

NetBeans not only has this "symbols" panel, but it has it collapsible for hierarchical elements. Besides, rather than only taking the file type by extension to search for related symbols, it parses the code smartly. Thus, if you have a tpl.php file with PHP code, HTML markup, and (I hope not, but...) CSS markup, NetBeans will take symbols from all these languages in a correct way, and display them in the symbols list grouped by language types. Sweet!

8. Find and Replace

Find and replace

One of the most irritating things for me personally is when you want to find or replace some text, and your editor displays a modal window with search parameters, searching for one at a time. No access to the text, just the "next" button. Gladly, NetBeans does not do that. It displays interface in the bottom of the window, highlighting all matches as you type, and it never prevents you from working with code.

There is also project-wide search, which displays the resulting file names and snippets of code where the string is found, in the results window at the bottom of the main window of NetBeans.

9. Visual Diff, Diff, and Patch

Diff and Patch

When working in Windows, going to console to apply patches is an unpleasant experience. Gladly, NetBeans saves the day. It can apply patches to files and directories. NetBeans can also show diffs and create patches from diffs, for the changes that you make to files and directories.

10. Database support

Database support

It's the last, but not least. NetBeans has a database explorer. Not as visual as PhpMyAdmin, but quite good if you know MySQL. After specifying your connection in the connections list, you can browse through the database, view and edit the schema, and run queries. When writing queries for your Drupal module, there is nothing as great a tool as first running them in NetBeans database explorer to see what the results are, and how much time each query takes.


These are not all of the benefits of NetBeans editor. These are just the ones I like most. Oh, I could remember the folding code, highlighting of language errors, diff markup on the window border, and showing files in split window.

If you are looking for a powerful and function-rich IDE for Drupal, you don't need to pay hundreds of dollars. There are already a few great tools, one of which I am using, and highly recommend.