tips for php coding in netbeans

I’ve switched from Vim to netbeans in the past 9 months or so – I’ve been using Vim for 5+ years before that and finding an editor to beat it wasn’t easy. Main aim was to get better code completion, plus whichever editor I used had to have ‘hippie search‘  – this speeds up coding no end. Tried eclipse PDT along the way but found that too slow.

Ultimately netbeans persuaded me to convert. Here are some tips for using it:

General tips

  • Use at least 6.8 beta version of netbeans – there are performance improvements for code completion which increase code completion a lot. If you’ve tried 6.7/6.5 – try again with the 6.8 beta+, especially with large projects.
  • Enable hippie search – The default keys are ctrl+k and ctrl+shift+k – If you’re a Vim person, change these to ctrl+p and ctrl+n. The ‘Actions’ in the keymap editor are ‘Next matching word’ and ‘Previous matching word’
  • Initiate code completion manually – use ctrl+space (default) I find the auto code completion popup just gets in the way. YMMV.
  • Use Navigate menu – this allows you to find files/classes/functions/methods in your code almost instantly
  • phpdoc your code: this allows code completion to work in places it otherwise could not

Symfony

  • Ignore ‘test’ directories – make sure you ignore certain dirs in symfony. This makes code completion ignore classes under those directories.  I have problems with it picking up classes not in our project e.g. sfContext can get confused with sfContextMock from the tests.
  • Symfony is supported in netbeans 6.8M2+ see http://blogs.sun.com/netbeansphp/entry/initial_symfony_support

3 Responses to “tips for php coding in netbeans”

  1. Jeff Rubinoff Says:

    Glad you like NB! We’ve got a screencast up demonstrating Symfony support, at http://channelsun.sun.com/video/open-source/netbeans/41815465001/symfony+framework+support+in+netbeans+ide+6.8/45090595001.
    Btw, does the Symfony framework give much support for RESTful web services? I’m working my way through a book now on RESTful PHP WS’es.

    Jeff

  2. Karim Ahmed Says:

    Hi,

    Thanks for your tips. I still find code completion slow, even now on 6.8! Do you or anyone else have more tips? I also find that it does not pick up my class methods when typing $instance->

    It’s a shame because although I like Netbeans, PHPEd has much better CC.

Leave a reply to symfonyandy Cancel reply