I want to add the namespace of a php class automatically with a shortcut/extension in vscode, but I can't find how to do this.
<?php
namespace App\Models;
class Article {
}
Use this handy PHP Namespace Resolver extension for Visual Studio Code.
How to use:
Another way is to
highlight the class by double click on the class name.
press ctrl
+ space
keys and then from the list, the namespace of
the specific class can be seen.
select the desired namespace from the list by up-down arrow keys
Tab
key to import the namespace automatically at above
the page.Hope this helps,
PHP Intelephense is the best extension I've ever used for this.
It provides both autocomplete and auto-import.
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