Category: Laravel, PHP

The CLI( Command Line Interface) is one of the best places to execute a long long-running task and Laravel has provided us with the Artisan Console that allows us to create our custom commands. I usually set up custom artisan commands whenever I am building something that requires initial setup or when I want to run queries on a large DB. In this tutorial, I am going to show you how to set up a custom Artisan command and how to calculate the execution time of that command. There are two ways to create a custom Artisan Console command, the Class-Based Command and the Closure Based Command.

To calculate the execution time of a custom command we can leverage the Laravel now()helper method.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners