PHP Use HelperPHP Use Helper helps you add, complete, sort, and clean PHP It discovers classes in your current project, prioritizes non- FeaturesComplete
|
| Action | Mac | Windows / Linux |
|---|---|---|
| Add use statement | Cmd+Shift+U |
Ctrl+Shift+U |
Sort use Statements
Run PHP: Sort use statements to sort imports alphabetically.
Shortcut:
| Action | Mac | Windows / Linux |
|---|---|---|
| Sort use statements | Cmd+Shift+S |
Ctrl+Shift+S |
Remove Unused use Statements
Run PHP: Remove unused use statements from the editor context menu. The extension detects imports that are no longer referenced in the file and removes them after confirmation.
Hover for Fully Qualified Class Names
Hover over an imported class name to see the fully qualified namespace from the matching use statement.
Framework Support
Symfony
PHP Use Helper includes presets for common Symfony classes such as controllers, HTTP foundation classes, routing attributes and annotations, forms, validators, security interfaces, serializer classes, and event subscribers.
Laravel
Laravel projects are supported through project class discovery and presets for frequently used Laravel classes, including HTTP requests and responses, controllers, facades, Eloquent models and builders, migrations, schema helpers, console commands, queues, notifications, mailables, and form requests.
Doctrine
Doctrine presets include ORM, repositories, persistence registry, pagination, and mapping attributes commonly used in Symfony and Laravel-adjacent PHP projects.
Supported Presets
Symfony
- AbstractController, Request, Response, JsonResponse, RedirectResponse
- Route attributes and annotations
- AbstractType, FormBuilderInterface, OptionsResolver
- TextType, EmailType, PasswordType, IntegerType, DateTimeType, SubmitType, ChoiceType, TextareaType
- ValidatorInterface, NotBlank, Length, Email
- UserInterface, PasswordAuthenticatedUserInterface, UserPasswordHasherInterface
- SerializerInterface, Groups, EventSubscriberInterface
Laravel
- Request, Response, JsonResponse, Controller, Redirector
- Route, Auth, Cache, DB, Log, Storage, Validator, Schema facades
- Collection, Model, Builder, HasFactory
- Migration, Blueprint, Command, ShouldQueue, FormRequest, Notification, Mailable
Doctrine ORM
- EntityManagerInterface, EntityRepository, ServiceEntityRepository
- ManagerRegistry, Paginator
- Mapping: Entity, Column, Id, GeneratedValue, ManyToOne, OneToMany, ManyToMany, JoinColumn, Table
PHP Standard
- DateTime, DateTimeImmutable, DateTimeInterface
- Exception, RuntimeException, InvalidArgumentException, LogicException
Installation
From the VS Code Marketplace
Install from the Marketplace:
ext install colscenery.php-use-helper
From a VSIX File
code --install-extension php-use-helper-1.0.3.vsix
Or open VS Code, run Extensions: Install from VSIX..., and select the VSIX file.
Requirements
- Visual Studio Code
^1.85.0 - A PHP workspace
Repository
Source repository:
https://github.com/TakashiHishiki/php-use-helper
Changelog
1.0.3
- Added project class discovery for
usestatement completion, excludingvendorand common generated folders. - Prioritized local project classes above framework presets.
- Added Laravel presets and README documentation.
- Updated Marketplace metadata for version 1.0.3.
1.0.2
- Updated the extension icon.
1.0.1
- Initial public release.
License
MIT