1. Ensure ZFtool is on your system
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.
1.2. Install the correct Composer dependencies for ZFTool
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.
2. Add Command Line Tool through settings
Through the settings (File | Settings) under Project Settings | Command Line Tools, we can enable the Zend Framework 2 ZFTool.
2.1. Add Command Line Tool
Click the Add button and select the Zend Framework 2 Tool.
2.2. Specify tool path
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:
2.3. Save settings
Save the settings and close the settings window.
3. Use the ZFTool from the Command Line Tools Console
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: