PhpStorm 2017.1 Help

Enabling a Command Line Tool

The PHP command line tools that are available from PhpStorm are listed in the Command Line Tool Support page of the Settings dialog box. Integration with command line tools is provided at the PhpStorm level, so once configured, a tool can be used in all your PhpStorm projects. Just activate or de-activate it when necessary depending on the needs of each specific project.

You can download and activate an existing third-party tool or create your own tool. You can update the command definitions of third-party or a custom tool right in the PhpStorm editor.

Note that PHP-specific command line tools work only with local PHP interpreters, see Configuring Local PHP Interpreters and Configuring Remote PHP Interpreters.

On this page:

To enable integration with a third party PHP command line tool

Integration with command line tools is supported via the Command Line Tool Support plugin. The plugin is bundled with PhpStorm and activated by default. If the plugin is not activated, enable it on the Plugins page of the Settings / Preferences Dialog as described in Enabling and Disabling Plugins.

  1. Download and install the desired tool. Currently PhpStorm supports integration with the following tools:
    1. Symfony version 1.1 or higher.
    2. Zend Framework 1, see http://framework.zend.com/download/overview.
    3. Zend Framework 2 (ZFTool, see http://framework.zend.com/downloads/latest.
    4. Composer Dependency Manager.
    5. Drush, version 5.8 and higher.
    6. Symfony console-based tools Laravel and Doctrine. These tools are installed through Composer.
  2. Open the PhpStorm settings and click Command Line Tool Support.
  3. In the Command Line Tool Support page, click the Add button. In the Choose Tool to Add dialog box that opens, choose Zend Framework or Symfony.
  4. In the dialog box that opens, specify the path to the definition file of the chosen tool in the Path to <tool> text box. Depending on the chosen tool, specify the location of the following file:
    • <Zend-Framework-home>/zf.bat for Zend Framework 1.
    • <Zend-Framework-home>/zf.php or <Zend-Framework-home>/zf.php for Zend Framework 2.
    • <Symfony-home>/data/bin/symfony for Symfony 1.*.
    • <Symfony-home>/app/console for Symfony 2.
    • <Composer-home>/composer.phar for Composer
    • C:/ProgramData/Drush/drush.bat on Windows and /usr/bin/drush on Mac OS or Linux for Drush.
    • For Laravel, the path to the artisan bundled with the tool, for example, C:\MY_PROJECTS\PHP_PROJECTS\MyLaravelProject\artisan.
    • For Doctrine, the path to the tool home.
    PhpStorm searches the contents of the specified file for definitions of commands. When the file analyzes is completed, PhpStorm displays the specified file in the list.
  5. In the Alias text box, specify the alias to use in calls of tool commands. Accept the default alias or edit it, if necessary.
  6. To activate the detected command set, select the Enable check box.
  7. Customize the command set, if necessary.
  8. In the Show console in area, specify where you want the Input pane for typing commands opened:
    • To have the Input pane opened in a pop-up window, choose the Pop-up option.
    • To have the Input pane opened as a text box at the bottom of the Command Line Tools Console tool window, choose the Tool window option.

To create a custom command line tool

  1. Open the PhpStorm settings and click Command Line Tool Support.
  2. In the Command Line Tool Support page, click /help/img/idea/2017.1/new.png. In the Command Line Tools dialog box that opens, choose visibility level of the tool (project or global), and its type from the Choose tool drop-down list.
  3. In the dialog box that opens, specify tool name and location, and the other required parameters.

    When you click OK, PhpStorm brings you to the Command Line Tool Support page, where the new tool is added to the list of available tools.

  4. Select the newly created tool and click /help/img/idea/2017.1/edit.png. In the tool definition .xml file that opens in the editor, define the tool commands.
  5. In the Show console in area, specify where you want the Input pane for typing commands opened:
    • To have the Input pane opened in a pop-up window, choose the Pop-up option.
    • To have the Input pane opened as a text box at the bottom of the Command Line Tools Console tool window, choose the Tool window option.

See Also

Last modified: 19 July 2017