I'm using Sublime Text 3 as text editor. I have seen some training videos where the instructor is pulling automatically the namespaces at the top lines of the .php file without typing. As far as I know this is a built-in feature in phpstorm, but I was wondering whehter this is available and for Sublime too?
I assume this can be done probably by a key shortcut or by installing a package? Anyone who knows how to do this?
If you use first use Package Control to install 'PHP Companion' (aka SublimePHPCompanion), you can add the keyboard shortcuts to do this.
1) Package Control: Install Package > PHP Companion
2) Menu: Sublime Text> Preferences > Key Bindings
3) Add the following lines (change f9/f10 if you want to use different keys)
{ "keys": ["f9"], "command": "expand_fqcn" },
{ "keys": ["f10"], "command": "find_use" }
Then you can use F9 to add the full path when typing a use command. If adding elsewhere in your code, F10 will add the full use statement at the top of the file for you.
There are other things you can add and more details at PHP Companion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With