This tutorial describes how to make use of the Zend Framework 2 Command Line Tool (ZFTool) in PhpStorm.
The Zend Framework tool (ZFTool) should be available on our system or in our project, for example by using Composer. Either option is valid.
To make use of ZFTool as a Command Line Tool, we can download zftool.phar and save it to our local disk.
If we do not make use of zftool.phar as described in the previous step, we can make use of the ZFTool by installing it through Composer.
The following composer dependencies should be installed:
To install Composer dependencies, right-click the project and select Composer | Add Dependency... in the context menu.
In the Add Composer Dependency dialog, search for the dependencies mentioned earlier and install them.
Through the settings (File | Settings) under Project Settings | Command Line Tools, we can enable the Zend Framework 2 ZFTool.
Click the Add button and select the Zend Framework 2 Tool.
Specify the path to either zftool.phar or zf.php.
The zf.php file lives under ./vendor/zendframework/zftool/zf.php when installed using Composer:
Save the settings and close the settings window.
From the Tools | Run Command... menu (Ctrl+Shift+X or Cmd+Shift+X on Mac), open the Command Line Tools Console. The zf tool is now available with autocompletion for all supported commands.
Commands can be run from the Command Line Tools Console: