Here is step by step guide to create a module in a zend framework 2 application using zendtool.

Step A. First Install zendtool

Step 1: First Download the Zend Tool from here. Secondly, extract the files into your root (www) localhost folder and rename the folder to anything you want. I will call it “zftool. So zendtool path look like this – C:\Program Files\php_5_4_15_Win32_VC9_x86\www\zftool

This file provides you with all the necessary files to create your basic folder structure.

Step 2: Download the zftool.phar from packages.zendframework.com

And copy it to zendtool folder.

Step 3: Open your Terminal. (In Windows 7, click Start and in the search box type “cmd” (no quotes), and click cmd.exe.

Step 4: Once opened, use the “cd” command to navigate to the folder where you created your project in your root (www) localhost folder. My command looks like this “cd C:\Program Files\php_5_4_15_Win32_VC9_x86\www″. You should be inside the root folder now and your line in Terminal should resemble this “C:\Program Files\php_5_4_15_Win32_VC9_x86\www>″.

Step 5: Now type this command, “php zftool/zftool.phar version” and press Enter, To check zendtool. For me look like this:

C:\Program Files\php_5_4_15_Win32_VC9_x86\www>php zftool/zftool.phar version

Output look like bellow:

ZFTool – Zend Framework 2 command line Tool

The ZFTool is using Zend Framework 2.2.0

This means zendtool install and working fine.

Step B. use zendtool

Step 1. Assumtions

Zendframework 2 project created with zf2 installed.

Path like this

http docs root path:

C:\Program Files\php_5_4_15_Win32_VC9_x86\www

zf2 project / application path:

C:\Program Files\php_5_4_15_Win32_VC9_x86\www\ZendSkeletonApplication6ACLNAV

Step 2. Use zendtool to create module in zf2 application

Here is how you can user zendtool on zf2 application for creating a module

Step a: Open your Terminal. (In Windows 7, click Start and in the search box type “cmd” (no quotes), and click cmd.exe.

Step b: Once opened, use the “cd” command to navigate to the folder where you created your project in your root (www) localhost folder. My command looks like this “cd C:\Program Files\php_5_4_15_Win32_VC9_x86\www″. You should be inside the root folder now and your line in Terminal should resemble this “C:\Program Files\php_5_4_15_Win32_VC9_x86\www>″.

Step c: Now type this command, “php zftool/zftool.phar create module user ZendSkeletonApplication6ACLNAV” and press Enter, To use zendtool. For me look like this:

C:\Program Files\php_5_4_15_Win32_VC9_x86\www> php zftool/zftool.phar create module user ZendSkeletonApplication6ACLNAV

Output look like bellow:

The module User has been created in ZendSkeletonApplication6ACLNAV

 

This means zendtool install and working fine.

 

Similarly other commands of zendtool can be used in zf2 application.

References:

1.)    https://maheshvnit.wordpress.com/2013/06/10/zend-framework-2-how-to-create-a-new-project-how-to-install-skeleton-application/

2.)    http://framework.zend.com/manual/2.2/en/modules/zendtool.introduction.html

2.)    https://github.com/zendframework/ZFTool