Laravel Console Command

  • Generate the command
    php artisan make:command command_name
  • Call command
    php artisan command:command_name --options arguments
  • Optionally, register An Command, add yourCommand to app/Console/Kernel.php
    protected $commands = [
        'App\Console\Commands\yourCommand'
    ];
  • Get a list of the commands
    php artisan list

    look for command:yourCommand, the $description you set in the command file will show up in the list

  • To display information on the screen while the command runs, put the following command within the command code
     $this->info('Display this on the screen');