suntechsoft/zend-expressive-tooling

Expressive的迁移和开发工具


README

仓库已于2019年12月31日废弃

此仓库已迁移至mezzio/mezzio-tooling

Build Status Coverage Status

Expressive的迁移和开发工具。

安装

通过Composer安装

$ composer require --dev zendframework/zend-expressive-tooling

expressive 工具

  • vendor/bin/expressive:所有工具的入口点。目前公开以下功能

    • action:create:创建一个动作类文件;这是下面列出的 handler:create 命令的别名。
    • factory:create:为指定的类创建一个工厂类文件。类文件创建在指定的类所在的同一目录下。
    • handler:create:创建一个PSR-15请求处理器类文件。同时也为生成的类生成一个工厂,如果应用程序容器中注册了模板渲染器,则生成一个模板并修改类以将其渲染为zend-diactoros的HtmlResponse
    • middleware:create:创建一个PSR-15中间件类文件。
    • migrate:interop-middleware:将互操作中间件和委托者迁移到PSR-15中间件和请求处理器。
    • migrate:middleware-to-request-handler:将PSR-15中间件迁移到请求处理器。
    • module:create:创建并注册一个中间件模块到应用程序。
    • module:deregister:从应用程序中注销一个中间件模块。
    • module:register:将中间件模块注册到应用程序。

可配置命令选项值

如果您的项目的--modules-path不在src下,您可以通过--modules-path命令行选项提供路径,或者在应用程序配置中配置它。通过将更改的路径添加到您的应用程序配置,您可以在执行各种module:*命令时省略使用--modules-path选项的需要。

// In config/autoload/application.global.php:

<?php

declare(strict_types = 1);

use Zend\Expressive\Tooling\Module\CommandCommonOptions;

return [
    /* ... */
    CommandCommonOptions::class => [
        '--modules-path' => 'custom-directory',
    ],
];