This feature is only supported in the Ultimate edition.

IntelliJ IDEA supports running commands of popular third-party or user-defined PHP tools: Symfony 1.1+, Symfony2, Zend Framework 1, Zend Framework 2 (ZFTool), Yii, Composer, Drush 5.8+, Laravel and Doctrine (Symfony console-based), WordPress Command Line Interface.

Check the Command Line Tools Tutorial for step-by-step guidance and examples of using command line tools with IntelliJ IDEA.

Before you start, install and enable the PHP and Command Line Tool Support repository plugins on the Plugins Settings page of the Settings / Preferences Dialog.

On this page:

How do I integrate an external PHP command line tool with IntelliJ IDEA?

  1. Download and install the tool
  2. Choose the tool type and visibility

    Open the Command Line Tool Support page (File | Settings | Tools | Command Line Tool Support for Windows and Linux or IntelliJ IDEA | Preferences | Tools | Command Line Tool Support for macOS). Click ../../Shared/add.png on the toolbar and in the Command Line Tools dialog choose the name of the tool from the list. In the Visibility area, specify whether you want to use the tool in the current project or globally, in any IntelliJ IDEA project, and click OK.
  3. Specify the tool alias

    In the Alias text box, accept the default alias to use in calls of tool commands or edit it, if necessary.
  4. Optionally customize the command set

    See How do I customize a tool? for details.

How do I run a command?

  1. Open the Input pane

    On the main menu, choose Tools | Run Command. The pane opens as as a pop-up window or as a text box at the bottom of the Command Line Tools Console tool window.
  2. Invoke the command

    Type the call of the command in the format <tool alias> <command>. The result of command execution is shown in the Output tab with the name of the command.
  3. Save the command output

    Click ../../Shared/exportToTextFile.png on the toolbar of the Output tab. In the Export Preview dialog that opens, specify the text file to store the output in or click Copy to save the output in the clipboard.

    If the file with this name and location already exists, choose to overwrite its contents with the new data or to append the new data to the existing file.

  4. To terminate a command

    Click ../../Shared/stop.gif on the toolbar. If the Output tab is already closed, kill the current thread from the progress bar.

How do I customize a tool?

  1. Open the tool definition file

    On the Command Line Tool Support page, select the tool in the list and click ../../Shared/edit.png on the toolbar. The .xml tool descriptor opens in the editor.
  2. Update the definitions of the commands

    As you type, .xml tool descriptor is checked for well-formedness on the fly.
  3. Reload the command definitions

    On the Command Line Tool Support page, select the tool in the list and click ../../Shared/refresh.png on the toolbar.

    Reloading commands is currently supported only for Symfony.

How do I define my own command line tool?

  1. Create a tool definition file
  2. Create a custom IntelliJ IDEA tool

    Open the Command Line Tool Support page (File | Settings | Tools | Command Line Tool Support for Windows and Linux or IntelliJ IDEA | Preferences | Tools | Command Line Tool Support for macOS). Click ../../Shared/add.png on the toolbar and in the Command Line Tools dialog box that opens, select Custom tool from the Choose tool list, and specify the visibility level for it (Project or Global).
  3. Specify the tool definition file and alias

    In the Tool Settings dialog, type the path to the tool definition file, the tool alias, and provide a brief description of the tool.

    When you click OK, IntelliJ IDEA brings you to the Command Line Tool Support page, where the new tool is added to the list.
  4. Choose where to show the Input pane

    See Choose the Input pane location above.
  5. Open the tool definition file

    Select the newly created tool and click ../../Shared/edit.png. The tool definition .xml file opens in the editor.
  6. Define the tool commands.

How do I keep a tool descriptor consistent?

Option 1: On-the-fly validation

Every time you edit a command definition in the .xml tool descriptor, IntelliJ IDEA checks it for well-formedness on the fly.

Option 2: Full validation

Full validation is performed every time you invoke a command. If any inconsistencies are detected, the tool is marked with the Invalid description icon ../../Shared/icon_incorrect_description.png on the Command Line Tool Support page.

To run full validation

  1. Open the Input pane

    On the main menu, choose Tools | Run Command. The pane opens as as a pop-up window or as a text box at the bottom of the Command Line Tools Console tool window.

    The location of the pane depends on the Show console in setting on the Command Line Tool Support page, see Choosing where to show the Input pane.

  2. Invoke validation

    Type the call of a command and in the Tool definition file errors tab, analyze the notifications on detected structure inconsistencies. Each notification shows a brief description of the problem, the file and the line number where the problem is detected.

    By default, the tab is hidden and opens when you click More in the Command Line Tool pop-up window with an error notification. To close the tab, click the cross on its header. To re-open it, click More once again.

    The Command Line Tool pop-up window remains on the screen until you close it manually.