Get notified if your app ever runs a really slow database query. We set a default threshold, but you can configure it based on your needs & expectations.
You can install the package via composer:
composer require thomasjohnkane/slow-query-notifier
// app/Providers/AppServiceProvider.php
use SlowQueryNotifier\SlowQueryNotifierFacade as SlowQueryNotifier;
public function boot()
{
SlowQueryNotifier::toEmail('admin@example.com');
}
If you are using this in production (as intendend) make sure it is working correctly:
php artisan sqn:test
This command will test two things:
- We can detect slow queries in your app
- We can send an email to you if a slow query runs
In general, we setup all of the configuration for you with sensible defaults. However, you can change the default settings if you'd like. To learn why we chose these defaults, read the blog post.
The default is 99ms. Set a different threshold
in milliseconds in your configuration:
SlowQueryNotifier::threshold(200)->toEmail('admin@example.com');
The package is enabled by default. Set this value to false
in your .env
to bypass the listener.
SLOW_QUERY_NOTIFIER_ENABLED=false
phpunit
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email thomasjohnkane@gmail.com instead of using the issue tracker.
- Thomas Kane
- Thanks to Marcel Pociot for the original inspiration
- Thanks to Caleb Porzio for the guidance
- All Contributors
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.