Log database queries for Laravel project
ngoctp/laravel-query-logger is a Laravel package for log database queries for laravel project.
It currently has 5 GitHub stars and 14.627 downloads on Packagist (latest version v1.0.8).
Install it with composer require ngoctp/laravel-query-logger.
Discover more Laravel packages by ngoctp
or browse all Laravel packages to compare alternatives.
Last updated
A simple service provider to log all database queries into a file for Laravel framework
This package supports Laravel 5.0 and newer versions.
You can also use this package with Lumen.
Import package using composer:
composer require ngoctp/laravel-query-logger --dev
There's nothing to do with Laravel 5.5, it's automatically imported by extra field defined in composer.json
Put ServiceProvider to providers list in config/app.php file.
It's the best to place before AppServiceProvider to log all queries from beginning.
NgocTP\QueryLogger\ServiceProvider::class,
Publish configuration file using command:
php artisan vendor:publish --provider="NgocTP\QueryLogger\ServiceProvider"
If you're using Lumen, add below line to bootstrap/app.php file
$app->register(NgocTP\QueryLogger\ServiceProvider::class);
After installed successfully, you can open terminal and use tail command to display queries realtime to console
tail -f storage/logs/query_logger.log
That's all, thank you for using
Happy coding :)