此包已被废弃且不再维护。没有建议的替代包。

Zend Framework 2应用程序的实用模块。

v0.1.0 2014-04-22 18:35 UTC

This package is auto-updated.

Last update: 2019-12-06 17:22:27 UTC


README

仓库已废弃 2019-12-05

此仓库不再维护。工具未更新以与 ZF3 兼容,随着过渡到 Laminas,我们将决定是否以及提供什么新的工具给 MVC 框架。

ZFTool 是一个用于维护模块化 Zend Framework 2 应用程序的实用模块。它从命令行运行,可以作为 ZF2 模块或作为 PHAR(见下文)安装。

特性

  • 类映射生成器
  • 加载的模块列表
  • 创建一个新项目(安装 ZF2 框架应用骨架)
  • 创建一个新模块
  • 创建一个新的控制器
  • 在控制器中创建一个新的操作
  • 应用程序诊断

要求

  • Zend Framework 2.0.0 或更高版本。
  • PHP 5.3.3 或更高版本。
  • 对正在维护的应用程序的控制台访问(shell、命令提示符)

使用 Composer 安装

  1. 打开控制台(命令提示符)
  2. 转到您的应用程序目录。
  3. 运行 composer require zendframework/zftool:dev-master
  4. 执行以下报告中的 vendor/bin/zf.php

使用 PHAR 文件(zftool.phar)

  1. 从 packages.zendframework.com 下载 zftool.phar
  2. 使用以下选项之一执行 zftool.phar(将 zftool.phar 替换为 zf.php

您还可以使用以下报告中的 bin/create-phar 命令生成 zftool.phar

用法

基本信息

zf.php modules [list]           show loaded modules
zf.php version | --version      display current Zend Framework version

诊断

zf.php diag [options] [module name]

[module name]       (Optional) name of module to test
-v --verbose        Display detailed information.
-b --break          Stop testing on first failure.
-q --quiet          Do not display any output unless an error occurs.
--debug             Display raw debug info from tests.

项目创建

zf.php create project <path>

<path>              The path of the project to be created

模块创建

zf.php create module <name> [<path>]

<name>              The name of the module to be created
<path>              The path to the root folder of the ZF2 application (optional)

控制器创建

zf.php create controller <name> <module> [<path>]

<name>      The name of the controller to be created
<module>    The module in which the controller should be created
<path>      The root path of a ZF2 application where to create the controller

操作创建

zf.php create action <name> <controller> <module> [<path>]

<name>          The name of the action to be created
<controller>    The name of the controller in which the action should be created
<module>        The module containing the controller
<path>          The root path of a ZF2 application where to create the action

应用程序配置

zf.php config list                  list all configuration option
zf.php config get <name>            display a single config value, i.e. "config get db.host"
zf.php config set <name> <value>    set a single config value (use only to change scalar values)

类映射生成器

zf.php classmap generate <directory> <classmap file> [--append|-a] [--overwrite|-w]

<directory>         The directory to scan for PHP classes (use "." to use current directory)
<classmap file>     File name for generated class map file  or - for standard output. If not supplied, defaults to
                    autoload_classmap.php inside <directory>.
--append | -a       Append to classmap file if it exists
--overwrite | -w    Whether or not to overwrite existing classmap file

ZF 库安装

zf.php install zf <path> [<version>]

<path>              The directory where to install the ZF2 library
<version>           The version to install, if not specified uses the last available

编译 PHAR 文件

您可以为 ZFTool 项目创建一个 .phar 文件。为了在 .phar 文件中编译 ZFTool,您需要执行以下命令:

bin/create-phar

此命令将在 bin 文件夹中创建一个 zftool.phar 文件。您可以使用并仅发送此文件来执行所有 ZFTool 功能。在创建 zftool.phar 之后,我们建议将 ZFTool 的 bin 文件夹添加到您的 PATH 环境变量中。这样,无论您在哪里都可以执行 zftool.phar 脚本,例如执行以下命令:

mv zftool.phar /usr/local/bin/zftool.phar

注意:如果以上操作由于权限问题失败,请再次使用 sudo 运行 mv 行。

待办事项

  • 模块维护(安装、配置、删除等。)[安装 已完成]
  • 检查应用程序配置。[已完成]
  • 部署 zf2 框架应用。[已完成]
  • 读取和写入应用程序配置。[已完成]