Zend_Tool is a command line tool released with the latest version of Zend Framework. It will jump-start the development automating some tasks like the creation of an empty project or of a controller class.
Other than from the command line, its possible to use Zend_Tool directly from Eclipse, lets see how.
First, download the framework and extract it.
I’ve had trouble with the full package of the 1.8.1 version, its seems to have a corrupted file in the tar.gz archive:
libraryZendToolFrameworkLoaderIncludePathLoaderRecursiveFilterIterator.php0000664
you can resolve the problem simply by renaming it to RecursiveFilterIterator.php
Now in Eclipse or Zend Studio for Eclipse, create and empty php project in a place accessible from your local webserver.
Now go to the “External tool” => “External Tools Configurations” panel to create a quick link to Zend_Tool.
NB: If you are using Zend Studio, you’ll have to remove the filter that hide “Program” item first:
Now you can create a new “external tool”:
- Click the new item button
- Give it a name
- Point it to the location of the
binzf.bat
file in your zend framework folder (where you have extracted it) using the Browse File System button - Set the working directory to the location of your newly created php project with the Browse Workspace button
- In the arguments box insert
${string_prompt}
. In this way Eclipse will prompt for input when you’ll start the tool.
Now in the “Enviroment” tab, configure two enviroment variable:
- Path: to your php.exe folder
- ZEND_TOOL_INCLUDE_PATH_PREPEND: to your Zend Framework
library
folder
In the Common tab check Display in favorites menu
and in the “Refresh” tab check Refresh resources upon completion => The project containing the selected resource
Now you can run it, and in the dialog write show version
. In the Eclipse console you’ll see the zend framework version.
Now you can experiment all the Zend_Tool commands of your choice:
create project [absolute path of your project]
create controller [name of the controller]
And don’t forget that you can create your own Zend_Tool command too.
Pingback: abcphp.com
Great how-to!
fyi . . .to get this to work in linux . . .replace zf.bat with zf.sh and you’ll be good. . . .
Thanks again!
Rich
I got this message ‘”php.exe”‘ is not recognized as an internal or external command,
operable program or batch file.
@Gabriela: in the Enviroment tab, have you setted the variable “Path” with the absolute path of your php.exe file? (for example: “C:xampplitephp”)
Fantastic tip! Cheers.
Hi…
if you use the comming Galileo Eclipse release, then you must set the Working Directory to ${workspace_loc} without the :/XXXXX stuff, otherwise eclipse gives an error: Variable references non-existent resource : ${workspace_loc:/ZendToolTest}!
Without the :/XXXX it works great!
@Mario Guenterberg: I’ve been using Galileo on about three projects in the last two weeks and don’t have the same experience as you: everything works when I include the ;/ProjectFoo… and wouldn’t otherwise.
It sounds like you must structure your projects differently, because omitting the reference would mean that the tool simply created the file structure in the workspace root.
@Madarco: many thanks for the awesome tip BTW… such a time saver!