How to create a custom console command (artisan) for Laravel Framework 6.16.0
Introdution : Laravel has a command-line interface named Artisan. This interface provides the developer a lot of useful commands to speed up the development process.commands that aim to make your life as a developer easier. Create and register command: The default command for creating user defined command is shown below − php artisan make:console <name-of-command> Example: php artisan make:command health:check This should create a HealthCheck class in the /app/console/commands directory with App\Console\Commands namespace. Finally, our command is not registered, therefore we need to add it into our /app/console/Kernel.php file in the $commands array (provide the class path and name): protected $commands = [ // Commands\Inspire::class, 'App\Console\Commands\Healthcheck' ]; Use php artisan cache:clear to clear the cache and try executing your command with the previous given name: php artisan health:check The last method in the HealthCheck class is the handle() meth