zf2-cli

A commandline tool for managing Zend Framework 2 projects

zf2-cli

Make Zend Framework 2 fancier by providing a commandline tool to automate mundane tasks such as initializing a base project, creating modules, models, controllers, etc.

sudo npm install -g zf2-cli
 

zf2

init - initializes a Zend Framework 2 project based create-module - creates a module create-model - creates model object and corresponding TableGateway

Initialize an existing directory as a ZF2 project

mkdir project-name
cd project-name
zf2 init
 

Initialize a new directory as a ZF2 project

zf2 init my-project
 

Creates a new Module under module and updates config/application.config.php.

 
zf2 init my-project
cd my-project
zf2 create-module Album
 

You can also create multiple modules in one fell swoop

 
zf2 init my-project
cd my-project
zf2 create-module Album User Advertisements
 
 
cd module/Album
zf2 create-model Album
 

You can also specify fields in the create operation

 
cd module/Album
zf2 create-model Album title artist releaseDate
 

This operation will create a model object with a corresponding TableGateway. It will also update the module's Module.php file to contain the needed servcie configuration to register the TableGateway with the service map.