以编程方式获取工匠命令列表 [英] Getting a List of Artisan Commands Programmatically

查看:46
本文介绍了以编程方式获取工匠命令列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Laravel PHP Framework时,是否有一种方法(在运行时)以编程方式获取当前已配置且可用的artisan命令列表?我基本上是在寻找认识的方式

When you're using the Laravel PHP Framework, is there a way, (at runtime), to programmatically fetch a list of currently configured and available artisan commands? I'm basically looking for way to know

  1. 所有命令名称

  1. All the command names

与该类对应的类或对象

推荐答案

和往常一样,只要我问自己清楚的问题,自助服务台就会响起.

As usual, self help desk strikes as soon as I ask myself the question clearly.

//app()->make('artisan')->all();        
foreach(Artisan::all() as $key=>$command)
{
    var_dump($key);
    var_dump(get_class($command));
}

这篇关于以编程方式获取工匠命令列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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