Search code examples
phplaravellaravel-artisan

Get all Laravel artisan commands for interface


When you use php artisan in the command line you get a list of all commands. Are there any opportunity to get all Laravel artisan commands programmatically? I need it for example to use it in a select field in the interface.


Solution

  • To get all command objects:

    \Artisan::all()
    

    To get all command names:

    array_keys(\Artisan::all())