Imports, expands, sorts and cleans up PHP use statements in VS Code
open sourceMITfree
A VS Code extension for PHP that manages use statements: it imports a class or every unresolved class at once, expands a short class name to its fully qualified name, sorts imports by length, alphabetically or naturally, removes unused ones and generates a PSR-4 or PSR-0 namespace from the file's path and composer.json. Unimported classes show as warnings and unused imports as hints, with quick fixes. It understands PHP 8 syntax (union and intersection types, constructor promotion, attributes, enums) and keeps a cached index of the workspace's classes. MIT licensed.
Problems it solves
- add PHP use statements automatically in VS Code
- clean up unused imports in my PHP files
- fix the namespace at the top of a new PHP file from its folder
Features
- imports one class or every unresolved class
- expands short class names to fully qualified names
- sorts and removes unused use statements
- generates PSR-4 or PSR-0 namespaces from composer.json
- warnings and quick fixes for unimported and unused classes
Alternatives
The same job
These do what PHP Namespace Resolver does.
- PHP Tools A full PHP IDE inside VS Code and Visual Studio
