Here a small tip for all the PHP developers, which want to see their code-templates in the code-completion list of NetBeans IDE.

First create your own code template in code-template options at “Tools|Options|Editor|Code Templates” and save the options.

Then open the code-templates file from your NetBeans user dir. For example: c:\Users\johndoe\AppData\Roaming\NetBeans\8.0.2\config\Editors\text\x-php5\CodeTemplates\org-netbeans-modules-editor-settings-CustomCodeTemplates.xml This XML file contains all your custom template settings for the given mime-type.

Search for your entry and add contexts="php-code" to the <codetemplate>-tag and save it.

This way the template will be displayed in the code-completion list too.

If you like to have a option for that in the UI the NetBeans IDE itself, then please file an issue at https://netbeans.org/bugzilla -> Not needed anymore. See the update below.

UPDATE: In the next version of NetBeans IDE (>8.1) no fiddling in files is needed anymore. Thanks to junichi11, who provided a patch to solve this via issue #246664 . The context can be set in the new context tab within the code-templates options.