Creating new Zend Framework project using Zend_Tool

Hello.

Another quick tip. To start a new Zend Framework project, the easiest way is using Zend_Tool for that. Please, install first the Zend_Tool follow this link at Zend Framework documentation page.

Creating new project

Let’s starting using the command line and creating a new ZF project.

zf create project my_project_name

Zend_Layout

Now, get in the project folder and enable Zend_Layout support:

cd my_project_name
zf enable layout

Database

Configuring database support:

zf configure db-adapter "hostname=localhost&adapter=pdo\_mysql&dbname=my\_project&password=12345&username=myuser"

And some DbTable:

zf create db-table posts

Using Zend_Tool we have a lot of options do create files (DbTable, models, controllers, actions, etc) using the command line.

All options

Type zf and press ENTER.

Zend Framework Command Line Console Tool v1.11.9  
Usage:  
zf \[--global-opts] action-name [--action-opts] provider-name [--provider-opts\] \[provider parameters ...\]  
Note: You may use "?" in any place of the above usage string to ask for more specific help information.  
Example: "zf ? version" will list all available actions for the version provider.

Providers and their actions:  
Version  
zf show version mode[=mini] name-included[=1]  
Note: There are specialties, use zf show version.? to get specific help on them.

Config  
zf create config  
zf show config  
zf enable config  
Note: There are specialties, use zf enable config.? to get specific help on them.  
zf disable config  
Note: There are specialties, use zf disable config.? to get specific help on them.

Phpinfo  
zf show phpinfo

Manifest  
zf show manifest

Profile  
zf show profile

Project  
zf create project path name-of-profile file-of-profile  
zf show project  
Note: There are specialties, use zf show project.? to get specific help on them.

Application  
zf change application.class-name-prefix class-name-prefix

Model  
zf create model name module

View  
zf create view controller-name action-name-or-simple-name module

Controller  
zf create controller name index-action-included[=1] module

Action  
zf create action name controller-name[=Index] view-included[=1] module

Module  
zf create module name

Form  
zf enable form module  
zf create form name module

Layout  
zf enable layout  
zf disable layout

DbAdapter  
zf configure db-adapter dsn section-name[=production]

DbTable  
zf create db-table name actual-table-name module force-overwrite  
Note: There are specialties, use zf create db-table.? to get specific help on them.

ProjectProvider  
zf create project-provider name actions

Published by

Junior Grossi

senior software engineer & stutterer conference speaker. happy husband & dad. maintains Corcel PHP, elePHPant.me and PHPMG. Engineering Manager @ Paddle

2 thoughts on “Creating new Zend Framework project using Zend_Tool”

Leave a Reply

Your email address will not be published. Required fields are marked *