IntelliJ IDEA 2019.1 Help


File | Settings | Languages and Frameworks | PHP | Composer for Windows and Linux
IntelliJ IDEA | Preferences | Languages and Frameworks | PHP | Composer for macOS
Ctrl+Alt+S the Settings/Preferences icon

The page is available only when the PHP and the Command Line Tool Support plugins are enabled. The plugins are not bundled with IntelliJ IDEA, but they can be installed from the JetBrains plugin repository as described in Managing plugins. Once enabled, the plugins are available at the IDE level, that is, you can use them in all your IntelliJ IDEA projects.

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



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 on the main menu will be executed in accordance with the settings from this configuration file.

You can have several composer.json files in one IntelliJ IDEA 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.

IntelliJ IDEA 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. IntelliJ IDEA 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.


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 checkbox to download a new instance of the file. The composer.phar file will be saved under the project root folder specified in the Location field.

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

  • To run commands via the composer executable running in a Docker container, choose Docker.

    • From the Server list, select the existing Docker server to use, or configure a new one as described in Enable Docker support.

    • From the Image name list, select the Docker image.

    • In the Composer executable field, provide the name of the Composer executable.

    • In most cases, IntelliJ IDEA detects path mappings and container settings automatically. Alternatively, you can click the Browse button in the Docker container field and specify the Docker container settings that will be used to start the container from an image. These settings may include the volume configuration, the exposed ports, the network, and so on.

    For details on Docker support in IntelliJ IDEA, see Docker.

Last modified: 20 June 2019

See Also