我没有通过 启动项目symfony new <prj_name>
,而是使用composer require symfony/console
. 我无法访问任何生成命令。
我做错了吗?如果我使用composer require
如何自动创建初始 bin/控制台?
我没有通过 启动项目symfony new <prj_name>
,而是使用composer require symfony/console
. 我无法访问任何生成命令。
我做错了吗?如果我使用composer require
如何自动创建初始 bin/控制台?
因此,在我开始仅使用并且必须手动创建 console.php 文件的现有项目中,我执行了以下操作:composer require symfony/console
需要 Sensio 捆绑包:
$ composer require sensio/generator-bundle
然后,在 console.php 中,需要Sensio Bundle
.
.
.
use Sensio\Bundle\GeneratorBundle\Command\GenerateCommandCommand;
.
.
.
$console->add(new GenerateCommandCommand());
现在,当我运行 console.php 文件时,帮助文本会显示该命令的链接。
$ php console.php
Console Tool
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
generate
generate:command Generates a console command