Take the 2-minute tour ×

I've recently gotten quite fond of netbeans for my php work because of the XDebug integration. It has made me all but forget about textmate (which imho still beats netbeans for the little things)

What do you think is the one awesome netbeans feature I should know about, and more importantly why and how do I use it?

I'm asking this to optimize my skills in the use of the IDE and based on the idea that what works well for others might just work for me (and hopefully others).

share|improve this question
the question is for netbeans as a whole or PHP plugin only? –  dfa May 29 '09 at 18:43
@dfa: I'm using it for php at the moment but if you have an awesome suggestion that would make me able to do mono development using netbeans, or... –  Kris May 29 '09 at 19:17

21 Answers 21

up vote 26 down vote accepted

The Subversion Integration directly on the IDE and the Local History are of my must-use, favorite features.

share|improve this answer
as well as mercurial, CVS and mercurial plugins –  dfa May 29 '09 at 18:44
Yes!, versioncontrol.netbeans.org –  CMS May 29 '09 at 18:48
@CMS definately a "good thing™" but somewhat taken for granted already. @dfa: yes, subversion integration rules. is mercurial worth looking into? –  Kris May 29 '09 at 19:15
NetBeans even integrates with ClearCase, which we use at work. –  Thomas Owens Oct 2 '09 at 19:38
Git support is on the way now: blogs.sun.com/netbeansphp/entry/git_support_available_on_uc –  Emanuil Rusev Mar 9 '11 at 10:40

I've found another great snip of genius i wanted to share:

you can do custom code folding (not really related to php, just netbeans)

just put this into a code file:

// <editor-fold defaultstate="collapsed" desc="getters and setters">

some boring code you don't need to see every time here

// </editor-fold>

That'll behave similar to #regions in visual studio or pragma marks in xcode. but unlike regions, it doesn't screw up the working of your code, it's really just a comment!

share|improve this answer
didn't even know about that!! +1 –  ChrisR Feb 16 '10 at 19:59
Can I make it work with Ruby's # comments? –  Alex Sep 24 '10 at 10:25
@Alex: it works with # comments as well –  Kris Oct 6 '10 at 12:33
So, I originally wrote that this is really cumbersome to do (at least when coming from #region/#endregion in C#), but see @snrp's answer about Code Templates below. Create code templates with #region and #endregion as the abbreviations, and you don't have to type the rest of that markup. Woo for Netbeans! –  Mattygabe Apr 20 '11 at 1:40
@Mattygabe: i would agree on the cumbersome with you if not for #regions ultimate suckyness: stackoverflow.com/questions/285422/… –  Kris Apr 23 '11 at 23:30

I find the single most useful feature in Netbeans for PHP work is that it understands PHPDoc (in the same way that it understands Javadoc), and uses it for type hinting.

Type /** before a function definition, hit return and it'll create a PHPDoc template.

/**                              <-- I typed this one line
 * @param <type> $otherObj       <-- Netbeans added these 3 lines
 * @return <type>                <--
 */                              <--
public function exampleFunction($otherObj)
    $myObj = new MyClass($otherObj);
    return $myObj;

Replace the <type> placemarkers with the appropriate types:

 * @param OtherClass $otherObj
 * @return MyClass
public function exampleFunction($otherObj)
    $myObj = new MyClass($otherObj);
    return $myObj;

And voila, you'll get type completion (and pop-up documentation) with Ctrl-space.

share|improve this answer
If you type hint your function arguments, Netbeans will pick that up and you will not have to replace the <type> text. –  leek Mar 24 '10 at 18:36
It's a shame that "Type Hints can only be of the object and array (since PHP 5.1) type. Traditional type hinting with int and string isn't supported." So you have to replace int and string <type>s. –  Vili Jun 10 '10 at 11:57
You can also use the @var tag on fields stackoverflow.com/a/7861397/843318 –  Jonathan Spooner Jul 5 '13 at 8:56

Awesome Vi bindings via the jVi plugin.

share|improve this answer
Okay, but Why would I want VI bindings in Netbeans? (The VI manual is bigger than my refrigerator and all I read into it is ":q!") –  Kris May 29 '09 at 19:21
I know it isn't everyone's cup of tea, but I find that I work much faster with Vi bindings. You should give them a try sometime. –  moshen May 29 '09 at 20:06
if ($x instanceof SomeClass) {
  $x->.... // now it has code completion with SomeClass' methods.
share|improve this answer
This is the type of thing i was hoping to learn lots more of. Unfortunately its not new to me but nevertheless upvoted and thanks! –  Kris Mar 21 '10 at 18:47
I think you can achieve the same result by typing vdoc and pressing Tab in line above $x creation, first assignment or usage. NetBeans will use $x type from phpDoc for code completion. It's cleaner solution imho, but "$x instanceof SomeClass" is also neat. –  JohnM2 Nov 18 '10 at 21:59
Agreed with JohnM2, using code doc is cleaner, but times where using instanceof actually fits the code logic (and doc doesn't specify the type), it's a great help. –  Jon L. May 29 '11 at 3:35
@Jon L, @JohnM2: Yeah, I never meant that instanceof should be abused that way, just that this is convenient when there is already an instanceof. –  Bart van Heukelom May 30 '11 at 8:08

Macros, and Code Templates with advanced input !

Parametrized code templates (try typing fnc in netbeans and then imediately press Tab, and then keep pressing Tab to see what happens, how it cycles through the function name and the function parameters - look inside the code template to see how this is done). (Options > Editor > Code Templates )

Some easy examples (some I made, some come with netbeans):

  • [forek] expands to: [foreach ($array as $key => $value) { }] (This one comes with netbeans, the rest I made)
  • [arr] + Tab expands to: [array();]
  • [kv] +Tab expands to: ['key' => "val", ] (key and val are parameters that I canc cycle through and edit with tab. The code template looks like this: ['${key}' => "${val}", ] where [${something}] is a template parameter, it prints [something]. if you want it tio print [$something] I think you have to use three ]$] characters: [$$${key}])

EDIT: You can make a code template for the arrow with a single letter (like 'm' for ex) , but when you type in code you have to put a space before the letter, else it wont recognize it. Ex: $obj m[press Tab], expands to [$obj ->]. The space inbetween works ok and is not a sintax error. /EDIT

Every time I wish there was a template for something, I actually insert the template and then use it imediately and continue with the rest of the php programming.

Macros with shortcuts as mini code templates ! (Netbeans >Menu > Edit >Start / Stop Macro Recording)

Best Macros I made for php are actually Code Templates (because ' + Tab doesnt work as code template for some reason, only if the template begins with a letter it works) ([shortcut] inserts [text]):

  • shortcut [Ctrl + ;] inserts [->] (no more keybooard gymnastics, no more dot sintax envy on other languages :))
  • shortcut [Ctrl + Shift + ;] inserts [ => ]
share|improve this answer
Definite +1 for this one. This isn't typical, but for the <editor-fold> tag above, that's a bit cumbersome for someone coming from C# used to a #region tag. Instead, I made a code template for both the beginning and ending tags to do custom Netbeans folding. –  Mattygabe Apr 20 '11 at 1:38

This link has a lot of keyboard shortcuts that comes in handy. I have a copy of it printed out and pinned to the wall next to my computer. Sadly, I don't see any special PHP shortcuts though.

UPDATE: http://netbeans.org/project_downloads/usersguide/shortcuts60.pdf UPDATE2: http://netbeans.org/project_downloads/www/shortcuts.pdf (for 7.0)

share|improve this answer
I love keyboard shortcuts, that is totally awesome. –  Kris Jun 7 '09 at 8:31
looks like this file is not there anymore? –  Neale Feb 23 '10 at 4:49
Same here. Whats with the 'binary' looking file? –  zaf May 10 '10 at 11:23
Edited the answer with a new link. Maybe not the same but better than the original link. –  zaf May 10 '10 at 11:25
That pdf is available under the netbeans help menu also. –  Ben Noland Aug 26 '10 at 15:24

I would add Tasks integration. Don't have time to finalize something? Add a simple task which NetBeans will track for you. You can customize what gets tracked in Tasks in Options -> Miscellaneous -> Tasks, but I found the format below to be most useful, as it aligns well with PHPDoc comments (see therefromhere's comment):

 * @todo Create public setters and __toString() for this class.
share|improve this answer
Agreed, very helpful, esp being able to view current file vs entire project. –  Jon L. May 29 '11 at 4:03

Ctrl + Space is my favorite and most used feature when programming in java, I think it is enabled for PHP as well. But if you like net beans you most likely know about it already, if not try it out discover what it does.

Also navigating to the relevant source code by Ctrl + Clicking on anything from variables, to method calls, to class references is a nice feature.

Additionally, the popup menus that are displayed when right clicking in source code contain many useful tools for everything from refactoring to code generation.

share|improve this answer
Yeah that works for PHP and it does rule. Not just for built-in functions, but everything (even type safe if you hint properly) –  Kris May 29 '09 at 19:19
CTRL+SHIFT+SPACE seems to have some similar but slightly different functionality as well. Haven't dug into it yet, but times when CTRL+SPACE fails for me, adding SHIFT will find what I need. –  Jon L. May 29 '11 at 3:37

This is going to sound ridiculously trivial, but one thing I do in Netbeans is code formatting. Its code formatting (source->format) rocks.

Its SVN integration is great too, but that's already been said.

share|improve this answer
alt-shift-f (auto-format), I use it all the time –  Ben Noland Aug 26 '10 at 16:03

The ability to create quick on the fly macros.

For example , here is one that will put a semi-colon at the end of the current line and places your cursor back where it was before the macro started.

";" delete-previous caret-end-line ";" jump-list-last-edit jump-list-last-edit (I know this is present in other language implementations by default. But it does not work by default in PHP Netbeans.)

As someone who tends to stick with IDE for a long time, I love being able to customize little things to make me more efficient.

share|improve this answer
That seems potentially very usefull, but I'm not getting it to work just yet, at least not automated and easier than command + right-arrow then semicolon –  Kris May 29 '09 at 19:24
I bound this to ctrl+semi-colon. The benefit to this, is that when you are complete, it returns your cursor back to its original position before the key combo was pressed. As with anything, what works best is usually what you are used too :) –  Gailin May 29 '09 at 19:44
@Galin: netbeans works better than what i was used to, just hoping to squeeze even more out of it. P.S. limited amount of votes sucks –  Kris May 29 '09 at 19:52
I would also suggest that you make use of the code templates (Tools->Options->Code Templates). When you are familiar with them, they can greatly enhance your work flow. Also, Alt+Ins performs code insertion. When you have a PHP class with class wide vars you can automatically create getters/setters to your class. It has the added benefit, of when you add more vars to the class, that you can generate getters/setters for the newly added variable. I switched to Netbeans about 3-4 months ago from PDT and previous to that phpEclipse. I have not regretted the decision. Poke around and enjoy! –  Gailin May 30 '09 at 1:52
@Gailin: the only code template i'm currently using is one I defined myself, "prop" creates a protected field, getter and setter with type hint and PHPDoc descriptions. basically 12 lines of code with five keystrokes. –  Kris Jun 8 '09 at 19:45

If you consider Netbeans 6.7 it has a sync feature a bit like Dreamweaver

In the way that you can add a custom ftp, import it to the project and when you save the files locally they are also uploaded to the server so you have a semi backup system in place.

(trust me it's better than working directly onto a ftp tree and realizing that the transfer failed somehow between the current tmp file and the server file and you lost your work because you closed the file window :) )

share|improve this answer
You have to be careful when running FTP support on existing pages though and the download/upload-selection is actually quite weird to control (right click and search box). I suggest adding multiple run configurations; one for making local changes (manual upload) and one for working live on your development server (upload on save). You can instantly switch between these configurations in the main toolbar. Furthermore, if are working on FTP with NB you can easily initialize a Mercurial repository and have a full revision control at your hand with just a few clicks. –  Energiequant Aug 24 '09 at 20:35

NetBeans also allows you to completely undock individual windows.

How to:
Right-click on toolbar of the window which you want to move and select Undock window. The selected window becomes a floating one, which allows you to move it outside of the main NetBeans window.


  • you can pin floating windows to screen borders or to different floating windows (just the ones from NetBeans though)
  • floating windows can make themselves semitransparent if you move away from them (configurable via main settings in Miscellaneous/Appearance)
  • if you move a different application over any floating windows, they come back on top after you start using NetBeans again
  • your workspace layout is remembered, so all floating windows keep their respective positions between individual coding sessions (NetBeans restarts)

This is useful especially if you have a second monitor, as it allows you to maximize the space available for source code by moving any supplementary windows (the file browser, unit test results, etc) away from the main screen. The nice thing is that NetBeans works around most annoyances which are usually present in multi-window applications (e.g. different applications covering individual toolbars in GIMP).

Note: perhaps this is commonly known feature, but I managed to discover it just today. It wasn't on the list yet, so I added it even though I already answered with a different feature some time ago.

share|improve this answer

maybe the search box, to find anything in the source code`?

share|improve this answer
i do like the incremental search, but the actual find dialog is weird in that it needs two distinct "enter" presses to start the search –  Kris Jun 5 '09 at 0:09

Some features definitely worth looking out for, including the ones mentioned above:

  1. Version control Integration, including Local History
  2. IDE wide search box
  3. Integration with Tomcat/Apache, GlassFish can be helpful when you are looking to work with PHP and other server side technologies, like JSP
  4. Very good integration with MySQL- essential to wAMP/LAMP development
share|improve this answer
actually, i couldn't get the MySQL stuff to work, it kept screwing up my carefully encoded UTF8, so i still use the normal commandline tools for that. –  Kris Jun 5 '09 at 0:07
In that case, why don;t you report the relevant problems to the mailing list? That way, they can surely be fixed :) –  Amit Jun 5 '09 at 4:16

TextMate is a great slick little editor I use all the time on my Mac, but not an IDE. I haven't enjoyed Netbeans on Mac very much being so non-native, but on Windows or Linux I prefer it over Eclipse.

  • The Swing GUI designer with Java has been huge in getting projects done rapidly.
  • Other people have said it, but integrated Subversion is awesome. If I've been working with a project from the terminal in Linux it figures out I've got SVN checked out on that directory and handles it fine.
  • I love the code formatting (right click in the editor), especially when team members write poorly spaced/indented code with nano, xemacs, or something like that.
share|improve this answer
Yeah the non-nativeness gets to me from time to time especially in the keyboard based text navigation department. But it comes with so many more awesome things I can mostly live with it. P.S. the code format shortcut is control+shift+f –  Kris Jun 8 '09 at 19:43

Squiglies under unused private class members.

share|improve this answer

its amazing that no one has talked about this cool plugin.


I have found it very useful for html. PHP developers do need it. It adds a lot of templates like this.

download zen-coding for netbeans and import zip file in tools>options>code templates>import.

share|improve this answer
I don't really see myself using this since I tend to use a highly custom DOM library for basically all my xml/html needs, but i see it being useful to many. –  Kris Aug 8 '11 at 9:11

I've personally used Eclipse a couple of years ago for Java development, and ever since i knew Netbeans at version 3.5, it has gotten really good with the integration of server technologies as TomCat for J2EE application deployment, subversion, uml and plenty of plug-ins for different tecnologies, not just java now.

  • Database integration (MySQL, Jdb, SQL editor).
  • Continuous progress in PHP integration and features.
  • Subversion integration...it does help A LOT!
  • Code indent, custom color highlighting.
  • If you are a PHP developer, Ruby on Rails integration can be of help too, if you want to expand your expertise on web apps.
share|improve this answer
Rails no longer exists in NB 7-series :-\ –  Jon L. May 29 '11 at 4:14
It's been quite some time since my answer, but unfortunately the support has been dropped. I'm sorry :( @Jon-l –  darksonxd Jul 16 '11 at 9:33

Netbeans has always been known for delivering support for experimental (not-yet-released) technologies, such as Java 6 EE preview, JDK7 support, ...

And, subversion support out-of-the box. It's a great difference to Eclipse, where you have to use plug-ins. With Eclipse I had only problems under Linux (JavaHL problems, blabla...). I don't remember who said it, or where it is written, but "out-of-the-box support is much more relevant to a user than the ability to use some plug-ins".

share|improve this answer
And yet they've decided to start removing support for various languages, such as Ruby, in the v7 series :-\ –  Jon L. May 29 '11 at 4:12
@Jon L. Ruby will still be maintained and supported through plugins. But perhaps with lesser effort than before. –  java.is.for.desktop Jun 2 '11 at 11:43

I like this the most: phpunit + code coverage

share|improve this answer

Your Answer


