PHP code example of eta / laravel-query-watcher
1. Go to this page and download the library: Download eta/laravel-query-watcher library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eta / laravel-query-watcher example snippets
'providers' => [
// ...
ETA\LaravelQueryWatcher\QueryWatcherServiceProvider::class,
],
return [
// Enable/disable the watcher
'enabled' => env('QUERY_WATCHER_ENABLED', true),
// Query count threshold
'threshold' => env('QUERY_WATCHER_THRESHOLD', 50),
// Log level (emergency, alert, critical, error, warning, notice, info, debug)
'log_level' => env('QUERY_WATCHER_LOG_LEVEL', 'warning'),
// Log channel (null for default)
'log_channel' => env('QUERY_WATCHER_LOG_CHANNEL', null),
// Slow query threshold in milliseconds (null to disable)
'slow_query_threshold' => env('QUERY_WATCHER_SLOW_QUERY_THRESHOLD', 1000),
// Log query SQL and bindings (be careful with sensitive data)
'log_query_details' => env('QUERY_WATCHER_LOG_DETAILS', false),
// Excluded paths (supports wildcards)
'excluded_paths' => [
// 'admin/*',
// '_debugbar/*',
],
// Excluded artisan commands
'excluded_commands' => [
// 'migrate',
// 'db:seed',
],
];
'channels' => [
'query-watcher' => [
'driver' => 'single',
'path' => storage_path('logs/query-watcher.log'),
'level' => 'warning',
],
],
'excluded_paths' => [
'admin/*',
'_debugbar/*',
'api/webhooks/*',
],
'excluded_commands' => [
'migrate',
'migrate:*',
'db:seed',
'queue:work',
],
bash
php artisan vendor:publish --tag=query-watcher-config