PhpStorm 2017.3 Help

Excluding Files from Projects

On this page:

Basics

Sometimes you might need to exclude a single file from your project, so that it will be ignored by inspections, code completion, etc. This is done using the Mark as plain text action.

When a file is marked as plain text, PhpStorm does not use it anymore for code completion and navigation. Such file is shown as plain text in the editor, and is marked with a special icon plain text icon in the Project Tool Window.

The reverse action is also available: you can return a file to its original type, using the Mark as <file type> action.

In the context of a PHP project, you can also exclude entire PHP archives (.phar files) to prevent multiple declaration conflicts between classes in a .phar archive and the corresponding classes in the installed vendors directory.

Marking a file as plain text

  1. In the Project Tool Window, select the desired file.
  2. On the context menu of the selection, choose Mark as plain text:
    mark as plain text

Marking a file with its regular type

  1. In the Project Tool Window, select the desired file, marked with plain text icon icon.
  2. On the context menu of the selection, choose Mark as <file type>:
    mark as file type

Excluding files and folders by name patterns

  1. Open the Directories page (File | Settings | Directories for Windows and Linux or PhpStorm | Preferences | Directories for macOS).
  2. In the Exclude files field, type the masks that define the names of files and folders to be excluded, for example, *.min.js. Use semicolons as separators.
    If the name of a file matches any of these patterns, the file is treated as excluded. If the name of a folder matches a pattern, all the files in this folder and in its subfolders are marked as excluded.
exclude by name pattern

Excluding a .phar archive from a project

In the Project tool window, select the required .phar archive and choose Exclude phar from project on the context menu of the selection.

Last modified: 6 December 2017

See Also