Laravel core team member Christoph Rumpel, in a recent video, demonstrated a new package that he created called Artisan Benchmark. The package allows you to benchmark your Artisan commands to get metrics such as:
- Execution Time
- Memory Usage
- SQL Query Count
- Number of Rows returned/affected
You can install this package using Composer:
composer require christophrumpel/artisan-benchmark
Then benchmark your command using:
php artisan benchmark your:command
If you don't pass in your command as an argument, it will display a list of available commands.
Note: this package only tracks query counts for queries executed through Eloquent or the Query Builder. However, contributions are welcomed to improve the package.
To learn more about this package, you can view the source code on Github.