Getting a List of Artisan Commands Programmatically

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 05:53:44

问题


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. All the command names

  2. The class or objects that corresponds to that class


回答1:


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));
}


来源:https://stackoverflow.com/questions/27279294/getting-a-list-of-artisan-commands-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!