You can run commands, analyze and export their output right in IntelliJ IDEA using the Command Line Tools Console tool window. The character set to be used in the tool window is chosen from the Console encoding drop-down list on the Command Line Tool Support page of the Settings/Preferences dialog box.
Note that PHP-specific command line tools work only with local PHP interpreters.
Before you start, install and enable the PHP and Command Line Tool Support repository plugins on the Plugins page of the Settings / Preferences Dialog.
On this page:
- Running a command
- Exporting the output
- Running a command line tool automatically after committing changes
Running a command
- On the main menu, choose . Depending on the Show console in setting in the Command Line Tool Support page, the Input pane opens either as a pop-up window or as a text box at the bottom of the Command Line Tools Console tool window.
-
In the Input pane, type the call of the command in the format
<tool alias> <command>.If you are using a tool from IntelliJ IDEA for the first time, create an initial tool project by running the tool-specific project generation command. The initial project is stored in the IntelliJ IDEA project root.
- View the result of command execution in the output tab named after the last invoked command.
-
To terminate a command, click
on the toolbar. If the Output tab is already
closed, kill the current thread from the progress bar.
Most command line tools operate within the context of their native projects. Note that a tool project is not the same as a IntelliJ IDEA project.
Exporting the output
-
Click
on the toolbar or press Alt+O.
-
In the Export Preview dialog that opens, do one of the following:
- To save the output in a text file, specify the target text file in the Export to file text box and click Save. 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.
- To copy the output to the clipboard, click Copy.
Running a command line tool automatically after committing changes
- Open the External Tools page ( for Windows and Linux or for macOS).
- Configure the command line tool as an external tool.
- Start committing your changes.
- In the After Commit area of the Commit Changes Dialog, choose your tool from the Run tool list.