Netbeans for PHP: Continues to Impress


Outdated Content

This post is over 6 years old and is probably out of date.

It seems that I don’t blog much unless IDE’s are concerned; there is a good reason for this: IDEs are an integral part of my development process and when they suck, development sucks.

The story so far:

  • Boy meets ZDE 2.5
  • ZDE grows up to 5.5
  • ZDE gets replaced by new eclipse-based ZSfE/PDT
  • ZDE keeps going, until one day, Boy upgrades OSX
  • Boy hacks OSX, but ZDE is running on a donut
  • OSX update kills ZDE for good
  • Boy cries
  • Boy finds Netbeans

This is the continuation of that story. In the last installment Netbeans 6.7 was a nightly build, it had gotten it’s OSX look and feel, and it was starting to get it’s remote debugging up and running.

Now, 6.8 has been out for almost 2 months, and things are really starting to gather steam. With the death of ZDE5.5 finally a reality, and PHP 5.3 code starting to become part of my work-day, I finally jumped 100% to Netbeans.

And let me tell you, Netbeans 6.8 is nothing short of amazing. Debugging with xdebug is now almost as easy as ZDE, it works instantly on 90% of my remote machines, but I have 1 cluster for which Netbeans simply *cannot* find the local source file, making it impossible to debug.

Watches, breakpoints (though, I haven’t figured out conditional breakpoints, if they are there), callstack and local variables work as you would expect (though watches/variables sometimes refuse to populate larger vars, I think this is xdebug config related). In addition, Netbeans supports arbitrary breakpoint groupings; these can be enabled and disabled as a group — very neat.

In addition, it has path mapping to help with remote/local file correlation; so it can find the local file to show the source during debugging — this stops the problem ZDE has where two files have the same basename() and it’s unable to choose the correct one.

However, a fully functional debugger is a minimum requirement. Netbeans 6.8 also has great support for PHP 5.3 (though it has some syntax support bugs), again another minimum.

So where does Netbeans shine? The single biggest answer to that, is PHPUnit support. Netbeans lets you specify your test folder, and abstracts it out of the project, so your tests are separated visually; this is a great minor addition. In addition, Netbeans can generate unit tests (this utilizes phpunit’s built-in functionality), and has a great UI for running tests.

You can run a single unit test by simply right clicking on the test and choosing Run, or you can test a whole project by right clicking on the project and choosing Test. Doing this will bring up the Test Results pane:

As you can see, it shows the number of tests, the test suite, and it’s test status; this can then be expanded to show individual test methods.

Further to this, you can have Netbeans capture code coverage information, if you have the xdebug extension installed locally. This then manifests visually in two ways; the first, is a summary:

The second, more impressive/useful way, is visually within each file:

You will also notice that this adds a set of buttons below the code, which can be used to run the test for just the current file (based on the typical phpunit file/test naming structure, I assume) and to re-run the entire test suite.

To me, this integration is phenomenal, and is changing the way I work. This is a great example of an IDE conforming to your workflow, and proving new ways to do things; rather than fighting you and requiring you to change to it’s needs and ideals.

Other things of note, Netbeans 6.8 has Symfony project integration, and 6.9 is including Zend Framework integration, if those things appeal to you — I have yet to play with either, so can’t comment on their usefulness.

I can, without doubt, confidently say, that despite the few bugs, and some still immature minor things, Netbeans is my recommendation for an IDE.

Go grab Netbeans today.

– Davey

Netbeans: The Other Open Source IDE Platform


Outdated Content

This post is over 7 years old and is probably out of date.

After seeing a SitePoint post on the Netbeans IDE I was intrigued by it’s new PHP support added in 6.5. I had toyed with Netbeans before when I was doing some Java-Swing development, some time around the 4.x version IIRC. I’d like it back then, for what it was, a Java IDE. I must admit it had slipped my mind since then; however I am still on the look out for a migration path away from Zend Studio 5.5 that doesn’t include Eclipse (which I  despise, Zend Studio for Eclipse/Zend Studio 6.0/PDT are a poor replacement for Zend Studio 5.5 as far as actual use goes).

The migration path is important for me not only for myself, for my team at work. Currently we use a mish-mash of ZDE 5.5, PDT (though nobody likes it, it’s free and does work with the Zend Debugger) and text editors.

I tried Netbeans 6.5 at the time the SitePoint post hit Planet PHP and while it seemed to work well enough, I didn’t have enough time to play with a new IDE at that point — also, the fact it looked terrible on OS X didn’t help — so I put it aside.

Then along came Solaris. Rather, a segfault in PHP on Solaris that I had to debug. I grabbed a VMWare disk image for OpenSolaris 2008.11 and booted it up in VMWare Fusion (a very pleasant experience I might add, just download, double click and I had a GUI booting OpenSolaris loading up Gnome!) and started to see if I could replicate the issue. After some advice from Wez Furlong I had SunStudio installed so I could use `dbx`, the Solaris “native” equivalent of `gdb` to figure out the problem. After fiddling with `dbx` for about 30 minutes, my co-worker said “This would be so much easier if you had an IDE that would pull up the source…” and it clicked: Why not try SunStudio? 

Turns out, SunStudio is to Netbeans as StarOffice is to Within a minute I had it attached to the PHP binary, ran my command and it automatically found and pulled in the PHP source; within 20 minutes I had narrowed the bug down to an issue in libmysql‘s prepared query code (with some help from Scott MacVicar regarding the PDO internals).

So, here, once again was Netbeans on my radar, and in this particular instance, shining, working flawlessly and helping me find an issue on a platform I’ve never used before, in minutes.

The next step — last night — was for me to try Netbeans 6.5 again, however another co-worker who has started using it, complained it wouldn’t bring up the source for remote files when debugging, so I grabbed the 7.0M1 build to see if this had fixed the issue. Once again, I was assaulted by the terrible Look and Feel, so I spent about 20 minutes trying to change it to at least use the familiar Java (metal) L&F with no success.

Today I decided to take another look and noticed in the “News” section of the IDE start page something about version 6.7 — confused, I read the linked story and saw that they were re-doing their versioning; from there I went to read the notes on what was changing, and there, I saw:

Better looking look and feel on Mac OS X:

New Mac Look & Feel

Now, it looks great on all platforms, it uses xdebug which means my team can pick and choose their IDEs (though I’m considering instituting NetBeans across the board anyways), it’s OSS, free (as in beer) which sits greats with management and most importantly… competent.

Netbeans, like Eclipse bills itself as an IDE platform, moving away from it’s Java roots, to include support for PHP, JavaScript, SQL, various markups and even Ruby/Rails. In addition it’s cross-platform like eclipse but worlds ahead in usability, look and feel, speed and resource usage.

I suggest if you’re looking for an alternative to the aging Zend Studio 5.5, Netbeans should be your first stop.

– Davey


Grab the Netbeans Nightly build for the new OS X L&F