How to create snippets for __construct?

3

I use CodeIntel for PHP, but when I try to create __construct I have to do everything manually. Does anyone know how to develop the snippet to create the same or have a plugin itself?

    
asked by anonymous 27.02.2015 / 05:16

1 answer

0

Go to Tools > New Snippet .

Then paste this sample code:

<snippet>
    <content><![CDATA[
public function __construct(${1:\$argument})
{
}
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>__con</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>

Save it in the Packages/User folder with the desired name, giving it the sublime-snippet extension.

Now just open a PHP file and type __con to appear the option of our small snippet test.

Comment : If you want to change the trigger to snippet to another name, simply change the value of tabTrigger to the desired value.     

20.08.2015 / 19:42