Netbeans for PHP: Continues to Impress

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

Cube°n for NetBeans on OSX (and others)

One of the things I’ve been most excited about with NetBeans, is the prospect of hooking it into Trac using Cube°n. Now, I should note that I didn’t even think about doing this till I ran across Mylar for Eclipse.  So, I went ahead and downloaded Cube°n, and installed it using the NetBeans plugins workflow:

Adding Downloaded Plugins to Netbeans Simply download and unpack the ZIP file (2.7MB) and then in NetBeans, choose Tools » Plugins, click the Downloads tab, and then Add Plugins… 

 In the file picker, just select all, and click Open. Next, click Install

 In a world where everything “Just Works”, that would be it. But unfortunately, on OSX, it’s sometimes not. While the plugin appears to function fine, when you to make it grab tickets, you will get a wonderful uncaught exception dialog.

 By default, OS X Leopard does not have the Java 6 (1.6) environment, so check if you have it. You can do so by looking to see if you have /System/Library/Frameworks/JavaVM.framework/Versions/1.6, if not you will need to grab Apples Java for Mac OS X Update 1 (57MB), Update 2 (136.4MB) and Update 3 (3MB) 

 Finally, even if you have Java 1.6, you will probably need to modify your NetBeans config to use it. This can be found in /Applications/NetBeans/NetBeans$ver.app/Contents/Resources/NetBeans/etc/netbeans.conf.

 

Open up this file, and look for: 

netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home

And change it to:

netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

Once this is done, just re-start NetBeans.

Add New Repository » Trac Repository » Trac Repository Settings

Next, go to Window » Cube°n » Task Repositories, and a new pane will appear in the bottom left under your Project/Files/Services pane. Right click in the new pane and choose New Task Repository; choose Trac Repository and give it an Alias (a name), and the rest of the information it needs.

Choose Validate Connection and then Finish. If you encounter an SSL error, see the Cube°n FAQ.

Finally, you can add queries to grab whatever collection of tickets you would like. You use the TracLinks query syntax which means you can create complex filters.

I have a filter for My Active Tickets, “owner=USERNAME&status!=closed|testing” and one for each milestone so I can see and accept tickets that are not mine, “milestone~=iris&owner!=USERNAME&status!=closed|testing”

Working with Tasks

Activate a Task to start creating it's Context

One of the biggest benefits of working with Cube°n [and Mylar] is the ability to associate a context with them; that is your open files, and other related tickets. To do this, simply click the Activate button. Once this is done, any currently open files are automatically associated with the ticket… or at least they would be if you were using Java. *sigh*

Still, it’s a start. Hopefully the guys at Cube°n will fix this oversight soon enough, and us lowly PHP developers will get in on the fun.

They are already working on some neat features, such as allowing you to commit to RCS using the task context (i.e. close a task, and commit all associated files), as well as associating debugger breakpoints and watches with the task; allowing you to make those task specific, even when two separate issues touch the same files. Both of these features would be great, making sure you don’t forget to commit a related file, and imagine being able to go back to a task 6 months later because a related issue has come up and having all your original files and debugging settings immediately available.

- Davey

Twitter

“@Harris_Bryan: Georgia Tech is offering a 100% online masters for $6,000!! http://t.co/IUdZgmCOad” - the closing is food for thought...

@dshafik [8 hours ago]

@ChiperSoft aaaah, ours is 8-7:30 or later. That came at about 10 months too. Also wife gets up early, I sleep in. Except sunday. :D

@dshafik [20 hours ago]

@dshafik oh she mostly sleeps through the night, but she wakes up at 6am, and we both like 8hrs of sleep :)

@ChiperSoft [20 hours ago]

@dshafik: I'm on IRC :-/

@derickr [20 hours ago]

Books & Things

Search

Archives

Tags