PhpStorm
 
Get PhpStorm

Auto import

Last modified: 11 October 2024

When you reference a PHP class that is defined outside the current file, PhpStorm locates the class definition and lets you do one of the following:

  • Automatically complete the fully qualified class name, including the namespace the class is defined in.

  • Automatically complete the short class name and import the namespace the class is defined in.

  • Import the namespace manually using a quick-fix.

The use statement is added to the imports section, but the caret does not move from the current position, and your current editing session does not suspend. This feature is known as the Import Assistant.

In JavaScript and TypeScript files, PhpStorm automatically adds import statements for modules, classes, components, and any other symbols that can be exported, as well as for XML namespaces. Learn more from Auto import in JavaScript, Auto import in TypeScript and Importing an XML namespace.