Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>PHP Use HelperNew to Visual Studio Code? Get it now.
PHP Use Helper

PHP Use Helper

Takashi Hishiki

|
2 installs
| (0) | Free
Easily add, sort, and remove PHP use statements. Includes presets for Symfony and Doctrine.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PHP Use Helper

PHP Use Helper

PHP Use Helper makes it effortless to manage use statements in your PHP files.
No more typing long namespaces by hand — just pick from the list and it's done.

Built with Symfony and Doctrine developers in mind.


Features

Add a use statement — Cmd+Shift+U / Ctrl+Shift+U

Place your cursor on a class name and press the shortcut (or right-click → PHP: Add use statement).
A quick-pick list appears, automatically filtered by the word under your cursor.
Select a class and the use statement is inserted at the correct position in your file.

Add use statement demo

Sort use statements — Cmd+Shift+S / Ctrl+Shift+S

Sorts all use statements in the file alphabetically in one step.
Also available via right-click → PHP: Sort use statements.

Remove unused use statements — right-click menu

Right-click anywhere in the editor → PHP: Remove unused use statements.
The extension detects which classes are not referenced in the file and removes them after confirmation.

Hover to see the full class name

Hover over any class name in your file to see its fully qualified namespace in a tooltip.


Keyboard Shortcuts

Action Mac Windows / Linux
Add use statement Cmd+Shift+U Ctrl+Shift+U
Sort use statements Cmd+Shift+S Ctrl+Shift+S

Right-click Context Menu

All three commands are available from the editor context menu when editing a PHP file:

  • PHP: Add use statement
  • PHP: Sort use statements
  • PHP: Remove unused use statements

Supported Classes

The extension includes presets for the most commonly used classes in Symfony and Doctrine projects.

Symfony

  • Controller, Request, Response, JsonResponse, RedirectResponse
  • Route (Attribute & Annotation)
  • AbstractType, FormBuilderInterface, OptionsResolver
  • TextType, EmailType, PasswordType, IntegerType, DateTimeType, SubmitType, ChoiceType, TextareaType
  • ValidatorInterface, NotBlank, Length, Email
  • UserInterface, PasswordAuthenticatedUserInterface, UserPasswordHasherInterface
  • SerializerInterface, EventSubscriberInterface

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

Adding Your Own Classes

Open src/extension.js and add entries to the COMMON_CLASSES array:

const COMMON_CLASSES = [
  // Add your own classes here
  'App\\Service\\MyCustomService',
  'App\\Repository\\MyRepository',
  ...
];

Installation

From VSIX file

code --install-extension php-use-helper-1.0.0.vsix

Or open VSCode → Cmd+Shift+P → Extensions: Install from VSIX...


Requirements

  • VSCode ^1.85.0
  • A PHP project (Symfony recommended)

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft