PhpStorm 2021.2 Help

Composer

On this page, enable execution of the Composer Dependency Manager commands through the dedicated user interface and appoint the default composer.json for the PhpStorm project.

Item

Description

Path to composer.json

In this field, specify the location of the composer.json that you want to use as default. All the Composer commands invoked from Tools | Composer from the main menu will be executed in accordance with the settings from this configuration file.

You can have several composer.json files in one PhpStorm project. For each composer.json, actions are invoked from its context menu in the editor or in the Project view, or using the shortcut links on top of the editor panel.

Add packages as libraries

Use this checkbox to configure the open-for-edit status of Composer packages. To protect packages under vendor/*/* against editing, leave the checkbox selected (this is the default setting).

If you want to edit the Composer packages under vendor/*/*, clear the checkbox.

Synchronize IDE Settings with composer.json

Select this checkbox to automatically detect the PHP language level and configure project Source and Test roots based on the configuration from composer.json.

PhpStorm is aware of PSR-0/PSR-4 source roots and their namespace prefixes. It sets the Source root the Source root icon based on the autoload section, and the Tests root the Tests root icon based on the autoload-dev section. PhpStorm also detects the PHP language level based on the php setting in the require section.

Because composer.json contains the most up-to-date information about the project configuration, this automatic synchronization ensures that the Source and Test folders exactly match the project structure, and the correct PHP language level is set automatically.

To learn more about PSR and autoloading, refer to the Composer official website. For examples and details on synchronizing settings, refer to the PhpStorm blog post. To learn more about configuring content roots, see Content root.

Check for available package updates

Use this checkbox to configure automatic checks for available package updates. By default, the checkbox is selected. To retrieve the available package updates and provide better coding assistance in composer.json, PhpStorm runs the update --dry-run command in background every time you open a project or modify composer.json.

Show composer.json top panel with quick actions

Use this checkbox to toggle the visibility of the quick actions panel displayed on top of the composer.json editor. See Work with composer.json for details.

Notify about missing 'vendor' directory

Select this checkbox to have PhpStorm check whether the vendor directory is missing and display the corresponding notification every time you open a project or modify composer.json. You can use the shortcut link in the notification to quickly install Composer dependencies.

Execution

In this area, choose how the Composer commands will be executed:

  • To run commands via a globally installed composer executable, choose 'composer' executable and specify its location in the field.

  • To run commands via the local composer.phar archive, choose composer.phar. Then, either specify the location of the existing composer.phar file in the field or select the Download composer.phar from getcomposer.org checkbox to download a new instance of the file. The downloaded composer.phar file will be saved under the project root folder.

    Then, choose one of the configured local PHP interpreters from the PHP interpreter list. Refer to Configure local PHP interpreters for details.

  • To run commands via a remote interpreter, choose Remote interpreter.

    • From the CLI Interpreter list, select a remote interpreter to use, or click the Browse button and configure a new one as described in Configure remote PHP interpreters.

      In most cases, PhpStorm detects path mappings automatically. If necessary, you can click the Browse button in the Path mappings field and specify them manually in the Edit Project Path Mappings that opens.

    • In the Composer executable field, provide the name of the Composer executable. You can click the Browse button, and locate the executable in the Select Path On The Server dialog that opens.

Last modified: 02 September 2021