symfony:“生成”名称空间中没有定义命令

时间:2019-10-18 01:35:47

标签: php symfony

我想用以下命令在symfony中创建一个包:

php bin/console generate:bundle

我得到了这个error

There are no commands defined in the "generate" namespace.



You may be looking for a command provided by the "SensioGeneratorBundle" which is currently not installed. Try running "composer require sensio/generator-bundle".

这个问题有什么解决办法吗?

先谢谢您

2 个答案:

答案 0 :(得分:0)

只需运行以下命令:

composer require sensio/generator-bundle

答案 1 :(得分:0)

如果您有新的symfony版本,请尝试使用此命令

composer require symfony/maker-bundle --dev

否则请使用此命令

composer require sensio/generator-bundle