01110000 01100001 01110011 01110011 01101001 01101111 01101110

Impressions with Netbeans 6.7 M3 for PHP

Posted: April 10th, 2009 | Author: Kevin | Filed under: Development, PHP, Tool | Tags: , , , | 7 Comments »

A recent contract job required me to work on-site, which meant that I had to use my laptop as my primary development rig. In eclipse, my low-end 1st gen Macbook Air crawls to its knees (surprise!) when I load it up with a 5000+ file project (including libraries).

Textmate is normally my tool of choice. But since we use a monster framework, code completion and inline documentation will undoubtedly boost my productivity and increase my familiarity with the existing API + codebase, not to mention the added benefit of a debugger to step through the code to know wtf is going on.

I went on a mission to find a new IDE. I decided to revisit Netbeans for PHP (I use it for Java already) by trying out the prerelease. After using Netbeans 6.7 M2 (and recently M3) for 2 months at work, aside from the occasional bugs, I could not be more impressed by its performance and feature-set. If you do decide to try it out, make sure you use the latest milestone release. That would be 6.7 M3 as of this post.

Lets look at some of the key features that I use on a daily basis.

Its fast!

Compared to PDT, Netbeans is significantly faster. With a large project open, PDT was barely usable on my air.

Code completion

Netbeans has the best code completion for PHP in any IDE I’ve used. Like most of the other IDEs, it uses PHPDoc comments to provide code completion and inline documentation for PHP.

It supports the @property tag, providing code completion for properties created by PHP magic __get and __set methods. I believe Netbeans is the only IDE that currently supports this.

It autocomplete your HTML, Javascript (with support for major JS libraries like jquery, dojo, prototype), and SQL (looks at your schema). Netbeans SQL completion

Code completion kicks in usually when you need it, but if it does not come up, you can trigger it using cmd+\.

One gripe I do have with the code completion is the lack of support for @return with multiple types separated by |. When your function docblock specifies multiple return types, it will not autocomplete that function at all.

Navigating around

In Textmate, I use cmd+T religiously to very quickly navigate to files in a project. The equivalent of this in Netbeans is control+shift+O. Unfortunately, this feature in Netbeans is way too slow to be remotely usable on my laptop.

Instead, I use cmd+o which allows me to navigate directly to a defined class. it is wicked fast :) This feature does throw an exception every time I try to use a wild-card. I do expect that to be fixed in the final release so I’ll live with that for now.

In Netbeans, you can also navigate directly to the definition of a class, method, attribute or variable by cmd+clicking on anywhere it is used. Also, when your cursor is over a variable, all occurrences of it (within scope) are highlighted making typos naturally stand out.

Quickly renaming variables

Renaming PHP variables in Netbeans

The refactoring features are not quite on par with Zend Studio for Eclipse, but it is still worth mentioning as I do use it on a daily basis. You can quickly rename a variable with control+r. It will correctly take into account the scope.

After you hit control+r, the instances in the current scope becomes highlighted and you can start typing the new name.

Code snippets/templates/expansions

You can create your own tab triggered code snippets. If you don’t know what they are or don’t realize the power of them, watch this screencast and find out what you’ve been missing.

Other notable mentions include integration with PHPUnit, code coverage, VCS integration (no git …).

Are you using Netbeans for PHP development? What are your favorite features? Do you have any tips/tricks to share? Let me know!

Like this post? Why not it with the world?
  • Digg
  • del.icio.us
  • Facebook
  • Reddit
  • Google Bookmarks
  • DZone
  • LinkedIn

7 Comments on “Impressions with Netbeans 6.7 M3 for PHP”

  1. 1 Its fast! | Webmaster Tools said at 7:24 am on April 10th, 2009:

    [...] See the rest here: Its fast! [...]

  2. 2 Patrick said at 11:37 am on April 11th, 2009:

    Hi Kevin,

    regarding Git integration in NetBeans, there’s a plugin called nbit which can be downloaded at http://github.com/myabc/nbgit/tree/master

    I just installed it from source and apart from not supporting the folder-wider .gitignore, everything works fine.

    Greetings

  3. 3 Kevin said at 4:43 pm on April 11th, 2009:

    Thanks Patrick! Interestingly I always switch to the terminal for doing svn/git commands, but I’ll give it a try!

  4. 4 kL said at 12:34 pm on April 12th, 2009:

    What’s with the blurry font? I can’t look at Netbeans. I refuse to use it until they have proper font rendering.

  5. 5 Kevin said at 9:31 pm on April 12th, 2009:

    If you’re on a mac thats how the fonts are rendered when you combine anti-aliasing with a larger font size. This will probably not be a problem for you. Give it a try! You’ll like it.

  6. 6 Tomas Mysik said at 9:15 am on April 16th, 2009:

    My favorite features are: - Go To Type (CTRL + O) - Go To File (ALT + SHIFT + O) [much faster in latest daily builds] - Go To Symbol (CTRL + ALT + SHIFT + O) - code completion for method overriding from parent class (just invoke CTRL + SPACE in the body of a class) - Run Configurations (in Project Properties) – you can define several run configurations – for local web, remote web or even command line

  7. 7 Darkredz said at 4:06 am on July 22nd, 2009:

    I am a great NetBeans fan and the IDE have been working really well with DooPHP framework with all the autocomplete and code hinting. Kudos to Netbeans!


Leave a Reply