By default, VS Code doesn’t have the option to import PHP Classes.
To achieve this, we have to use an extension.
Let’s open the Extensions panel by pressing down CTRL + SHIFT + X
on Windows or go to File -> Preferences -> Extensions and search for PHP Namespace Resolver.
After you have installed the extension, go to your PHP file and select a Class you want to import.
Right-click on it and now we have the option to import our Class.
In addition, this extension also comes with other features but I’ll leave it to you to explore.
A potential downside of this extension is that it hasn’t been updated in a long time.
However, I use it every day and I haven’t had any problems with it.
It’s up to you if you decide if you want to use it or not.
I hope you found this video helpful.
Happy coding!
Let me know what you think about this article in the comments section below.
If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.