Netbeans: Code Completion for the Kohana Framework

In some earlier posts I’ve described ways to get Netbeans code completion working for CodeIgniter. In this post I will show you how to do the same for Kohana.

Kohana is originally a PHP-5 only fork of CodeIgniter, but it has developed into much more. Now all code has been rewritten, so only the framework in concept is based on CodeIgniter. It has nice ORM, AUTH and Cache modules.

It’s easy to convert and actually I prefer Kohana, it’s more intuitive and extensible. The only drawback: Kohana needs PHP 5.2+, where CI can be used with PHP 4.

Kohana uses the PHP class autoload feature, no need to include class files manually, PHP will lookup the file on the included path automatically at the moment the class is mentioned.
So when you write.
$this->db = New Database
The Database class declaration file will be loaded by PHP automatically. This way of lading classes is also understandable for the auto completion parser of Netbeans.

This is in contrast to CodeIgniter, because there classes are loaded like:

To achieve code completion for CodeIgniter in Netbeans we have to manually insert comments to help the auto completion parser map properties to classes:
* @property CI_DB_active_record $db

That’s not the case in Kohana, but there is another problem. Kohana uses Class suffixes. The classes are declared like Database_Core, but called like Database (without the _Core).
To evade that we grap to the netbeans_ci_code_autocompletion helper file trick. But here we don’t write the property in comments, we simple do this:
Class Database extends Database_Core{}

You can see the discussion on which this post is based in the Kohana forum. There is even a script that will generate the file automatically, so it will do extensions aswell. Works for Zend, Netbeans and Eclipse.

You can find the script here:

There is a nasty flaw though on the website, they mixed up names. The script should be activated by:


And it will create a zend_autocomplete.php file in the cache directory. You can move that to the nbproject folder if you want.

11 Responses to “Netbeans: Code Completion for the Kohana Framework”

  1. Darkredz Says:

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

  2. Mamitaevonous Says:

    ??? ? ????. ???????? ? ?????????? ???. – ??????????? ??? ? ???????? )

  3. Heartshare » Blog Archive » CodeIgniter auto complete with Netbeans Says:

    [...] [...]

  4. Gangster27 Says:

    However, we cannot afford to be complacent. ,

  5. keyur patel Says:

    nice article, thanks

  6. Migraine Treatment Says:

    ;-~ I am really thankful to this topic because it really gives up to date information ‘,,

  7. Decking Kits Says:

    “:” I am really thankful to this topic because it really gives useful information -:’

  8. Nico Says:


    FYI – from your tip – i wrote a CI @property generator

    code available on CI forum :

  9. Archibald Says:

    Hey all, I discovered your site by using Yahoo even while hunting for a very similar issue, your site came out, it appears to be great. I’ve bookmarked it within my google book mark

  10. Marie Says:

    Thank you!! I was looking for Netbeans+codeigniter tutorial for a long time!! But How about Joomla support?

  11. post 2 host Says:

    post 2 host…

    [...]My Beloved PHP » Blog Archive » Netbeans: Code Completion for the Kohana Framework[...]…