inroutephp/console

Inroute 命令行编译工具。

1.1.0 2019-12-23 23:14 UTC

This package is auto-updated.

Last update: 2024-08-24 09:27:25 UTC


README

Inroute

inroutephp/console

Packagist Version Build Status

Inroute 命令行编译工具。

安装

Inroute 控制台组件应作为开发依赖项安装。但是,要执行编译后的路由器,必须提供 inroute 运行时。这使我们有一个两步安装过程。

composer require inroutephp/inroute
composer require --dev inroutephp/console

构建配置

默认情况下,构建配置是从当前工作目录中名为 inroute.json 的文件中读取的。一个简单的配置文件可以看起来像这样:

{
    "source-dir": "src/Controller",
    "source-prefix": "MyApp\\Controller",
    "target-filename": "src/HttpRouter.php",
    "target-namespace": "MyApp",
    "target-classname": "HttpRouter"
}

以下是一个可能的配置值列表

autoload

项目自动加载器的路径。默认为 vendor/autoload.php

container

编译时容器的类名。如果编译时对象有依赖关系需要注入,则此值是必需的。

bootstrap

编译时引导脚本的类名。通常不需要。

source-dir

用于扫描注释路由的目录。相对于当前工作目录。

source-prefix

在扫描目录时使用的 psr-4 命名空间前缀。找到的 .php 文件假定包含具有此命名空间前缀的类。

source-classes

源类名数组,用于替代或与目录扫描一起使用。

ignore-annotations

在编译过程中要忽略的注释数组。

route-factory

路由工厂的类名,默认值通常足够。

compiler

编译器的类名,默认值通常足够。

core-compiler-passes

核心编译器遍历数组,默认值通常足够。

compiler-passes

自定义编译器遍历数组。

code-generator

要使用的代码生成器,默认值通常足够。

target-filename

路由器转储目标的路径。如果此文件存在,它将被覆盖。

target-namespace

生成的路由器的命名空间(默认为无命名空间)。

target-classname

生成的路由器的类名(默认为 HttpRouter)。

使用方法

构建

要构建项目路由器,只需运行

vendor/bin/inroute build

更多信息

vendor/bin/inroute build -h

调试

要查看生成的路由器的调试信息,运行

vendor/bin/inroute debug

要获取更全面的输出,尝试

vendor/bin/inroute debug -v