流明make:command [英] Lumen make:command

查看:74
本文介绍了流明make:command的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过命令行在我的Lumen安装中执行代码.在完整的Laravel中,我读到可以通过"make:command"使用命令来实现此目的,但是Lumen似乎不支持该命令.

I'm trying to execute code within my Lumen install via the command line. In full Laravel , I've read that you can use commands to achieve this via "make:command", but Lumen does not seem to support this command.

是否有启用此命令的命令?如果失败,从Lumen的CLI运行代码的最佳方法是什么?

Is there anyway to enable this command? Failing that, what's the best way of running code from the CLI in Lumen?

谢谢

推荐答案

您可以像在Laravel中一样使用Lumen中的artisan CLI,但内置命令更少.要查看所有内置命令,请使用流明中的php artisan命令.

You can use the artisan CLI in Lumen as the same way as in Laravel but with fewer built-in commands. To see all built-in commands, use the php artisan command in Lumen.

尽管流明处没有make:command命令,但是您可以创建自定义命令:

Although there is no make:command command at Lumen, you can create your custom command:

  • app/Console/Commands文件夹中添加新的命令类,您可以使用框架

  • Add new command class inside the app/Console/Commands folder, you can use the sample class template of the framework serve command

通过将创建的类添加到app/Console/Kernel.php文件内的$commands成员中来注册自定义命令.

Register your custom command by adding your created class to the $commands member inside the app/Console/Kernel.php file.

除了生成命令外,在使用Lumen时,您可以使用 Laravel文档获取命令.

Except the command generating, you can use the Laravel docs for commands when working with Lumen.

这篇关于流明make:command的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆