Home >Development Tools >phpstorm >How to enable command line tools in PhpStorm
This article mainly introduces how to use the command line tools in phpstorm.
PhpStorm download address:
PhpStorm Mac version: http://www.php.cn/xiazai/gongju/510
PhpStorm 18.2.1 Win version: http://www.php.cn/xiazai/gongju/122
PhpStorm uses command line tools, we can call commands directly from the IDE ! Before we use any command line tool, we have to enable it in the settings.
The steps involved are as follows:
Use the command line tool console
Enable the command line tool
Enable a well-known command line tool
Enable a custom command line tool
Define the command line tool to add the auto-complete function
Use the command line tool console
We can use Tools | Run Command... to bring up the command line tool Run Command menu Or use Ctrl Shift X (Cmd Shift X on Mac).
The command line tool supports automatic completion of several known tools. We need to add and enable the tools we want to use through settings. For example, after adding Composer, we get autocomplete on all composer commands (note that in the screenshot below, the default alias "c" has been changed to "composer"):
We can also add other tools. The following is an example using the Symfony tool, alias s.
Enable command line tool
Enable a well-known command line tool
PhpStorm supports various well-known tools:
Composer
In this tutorial, we will select Composer as the tool and specify Project as Visibility.
For this example, specify the path to composer.phar. If Composer is already used in the project, PhpStorm should fill in this path automatically.
In our example, Composer added the alias "c".
5. Close settings.
Enable custom command line tools
To enable custom tools, you can follow Similar workflow.
1. From Project Settings | Command Line Tool Support, use the icon on the toolbar to add a new tool
2. Select a custom tool. The tool can be enabled only for the current project or globally (for all projects).
3. In the next step, some additional settings must be provided: tool name, full path to the tool, alias and description:
4. Click OK, and note that the tool is added to the list of command line tools. We can see the alias (which will be used to call the tool) and the full path to the tool.
5. Alternatively, we can provide the IDE with auto-complete information.
6. Close settings.
Add autocomplete for custom command line tools
PhpStorm cannot determine autocomplete for every custom tool we add automatically. But we can create our own definitions.
1. From Project Settings | Command Line Tool Support, select the tool for creating autocomplete information and click the "Open definition in browser" button to generate the boilerplate command Line tool description:
2. The editor will open an XML file where information about the custom tool can be added. We can now define commands, parameters and help information for custom command line tools. You can also check the Command Line Tools - Custom Tools command definition.
3. After saving the XML file containing the description, PhpStorm will recognize the command and provide autocomplete for our custom command line tool.
This article is about the steps of using the command line tool in PhpStorm. I hope it will be helpful to friends in need!
The above is the detailed content of How to enable command line tools in PhpStorm. For more information, please follow other related articles on the PHP Chinese website!