I've been taking the time to configure my installation of NetBeans recently and I've re-discovered my love for code templates. Code templates allow the developer to make a shortcut to boiler plate code snippets which usually have targetted keywords. In the latest Zendcast video tutorial, I started showing off a code template I made by calling "zndtst" and then hitting TAB.
You can setup your own code templates in the PHP options in NetBeans:

Here's the code template I use for generating unit test cases:
/** * Test class for ${classname} * @author: jlebensold */ class ${classname} extends ControllerTestCase { protected $$${obj}; public function setUp() { parent::setUp(); $this->${obj} = new ${class_to_test}(); } public function tearDown() { $this->${obj} = null; } }
{ 6 comments… read them below or add one }
Thanks! Still testing NetBeans as my PHP IDE and this stuff helps. Are you back to NB 100% or will you continue to use ZS?
hey jon,
enjoyed seeing the template do the work in your zendcasts.com series. very nice!
how would you realize this in Zend Studio or eclipse?
best, udo
Hey Udo,
I never figured out how to create Templates in Zend Studio! I’m sure its possible, Eclipse is a big elephant when it comes to development features
@John:
For now I’m back on NetBeans. To be honest, I haven’t taken the time to see what a complete implementation (Zend_Server / Zend_Studio / Zend_Framework) would look like. I’m a big fan of the framework, but until I see something like ReSharper for PHP development, I’ll be flipping back and forth.
Jon, what are your thoughts on JetBrains’ WebIDE for PHP?
gah! I didn’t know JetBrains finally came around to writing an IDE for PHP! I emailed them almost 2 years ago after falling in love with ReSharper. I’m downloading it now