The Laravel package which log all executed queries.
Laravel Query Log Tracker has the following features:
- Log all executed queries with the following items:
- SQL with bound parameters
- Bind parameters
- Execution time in milliseconds
- Connection name
- Disable/Enable query logging at runtime
- More configurations:
- Log level
- Exclude patterns
- Channels
Laravel Query Log Tracker has the following requirements:
- PHP >= 7.3
- Laravel >= 6.0
Execute the Composer require command:
composer require ngmy/laravel-query-log-trackerThis will update your composer.json file and install this package into the vendor directory.
If you don't use package discovery, add the service provider to the providers array in the config/app.php file:
Ngmy\LaravelQueryLogTracker\QueryLogTrackerServiceProvider::class,If you don't use package discovery, add the alias to the aliases array in the config/app.php file:
'QueryLogTracker' => Ngmy\LaravelQueryLogTracker\QueryLogTrackerFacade::class,Execute the Artisan vendor:publish command:
php artisan vendor:publishThis will publish the configuration file to the config/ngmy-query-log-tracker.php file.
You can also use the tag to execute the command:
php artisan vendor:publish --tag=ngmy-query-log-trackerYou can also use the service provider to execute the command:
php artisan vendor:publish --provider="Ngmy\LaravelQueryLogTracker\QueryLogTrackerServiceProvider"Execute queries with Laravel. That's all.
There are two ways to disable log.
QueryLogTracker::beginDisable();
// Execute queries for which you want to disable log
QueryLogTracker::endDisable();QueryLogTracker::disable(function () {
// Execute queries for which you want to disable log
});