Robo
PhpStorm lets you execute commands of the Robo PHP task runner right from the IDE.
If Robo is installed and initialized in your project, PhpStorm parses the contents of the RoboFile.php file, detects the public methods of the RoboFile class as executable commands, and displays them in a dedicated Robo tasks tool window. Alternatively, you can run the methods in the RoboFile.php file directly from the editor.
PhpStorm creates a default run configuration for the invoked Robo command, executes it and displays the output in the Run tool window.
Install and initialize Robo
To use Robo in PhpStorm, you need to install the Robo library in your project with Composer.
Inside composer.json, add the
consolidation/robo
dependency record to therequire
orrequire-dev
key. To get code completion for the package name and version, press Ctrl+Space.{ "require-dev": { "consolidation/robo": "^4.0.3" } }Install the dependency to your project from composer.json by either of the following:
Click the Install shortcut link on top of the editor panel.
If the Non-installed Composer packages inspection is enabled, PhpStorm will highlight the declared dependencies that are not currently installed. Press Alt+Enter and select whether you want to install a specific dependency or all dependencies at once.
In the Terminal tool window, execute the
robo init
command to add a RoboFile.php file to the project root.For guidance on adding commands to RoboFile.php, refer to the Robo documentation.
Run Robo tasks in PhpStorm
You can run a Robo command in PhpStorm by one of the following ways:
Double-clicking the command on the list in the Robo tasks tool window. To open the Robo tasks tool window, select the Robo tasks bar on the sidebar or select from the main menu.
From the RoboFile.php file. Open RoboFile.php in the editor, click in the gutter next to the required method and select Run 'Robo task <name>' from the context menu.
As a Run Anything action. Press Ctrl twice to open the Run Anything popup and type the Robo command name in it.
Manage Robo run configurations
As with any other run/debug configuration in PhpStorm, you can save as permanent, share, create from a template, group in folders, or save for later use a run configuration for Robo.
Create a custom Robo run configuration
You can create a custom Robo run configuration or edit an existing default one.
Go to Edit Configurations from the list on the toolbar.
. Alternatively, selectIn the Edit Configurations dialog that opens, click the Add button () on the toolbar and select Robo from the list.
To edit the latest run configuration, click on the toolbar in the Run tool window.
In the Robo configuration dialog that opens, fill out or edit the Robo-specific settings as follows:
File
Path to the robo executable file. PhpStorm by default sets the path to the robo file in the vendor/bin folder.
Arguments
The Robo command name and path to your RoboFile.php file where Robo methods with arguments are defined in the following format:
<command name> --load-from <path to RoboFile.php>
.For more information about configuring general run configuration settings, refer to Run/debug configurations dialog.
Run a Robo configuration as a startup task
If you have Robo tasks that you run on a regular basis, you can add the corresponding run configurations to a list of startup tasks in the Startup Tasks settings. The added tasks will be executed automatically on each project startup.