Skip to content
Get notified if your Laravel app ever runs a really slow database query
PHP
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config WIP Feb 10, 2020
src Add initial release README Feb 15, 2020
tests WIP Feb 10, 2020
.gitignore init commit Feb 1, 2020
CHANGELOG.md Add initial release README Feb 15, 2020
CONTRIBUTING.md init commit Feb 1, 2020
INSTRUCTIONS.md
LICENSE.md init commit Feb 1, 2020
README.md Minor readme update Feb 18, 2020
composer.json Update composer description Feb 15, 2020
composer.lock WIP Feb 10, 2020
phpunit.xml.dist

README.md

Slow Query Notifier for Laravel

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.

Installation

You can install the package via composer:

composer require thomasjohnkane/slow-query-notifier

Usage

Set an email address

// app/Providers/AppServiceProvider.php

use SlowQueryNotifier\SlowQueryNotifierFacade as SlowQueryNotifier;

public function boot()
{
    SlowQueryNotifier::toEmail('admin@example.com');
}

Test it works (in Production)

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

Configuration

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.

Threshold

The default is 99ms. Set a different threshold in milliseconds in your configuration:

SlowQueryNotifier::threshold(200)->toEmail('admin@example.com');

Enable/Disable

The package is enabled by default. Set this value to false in your .env to bypass the listener.

SLOW_QUERY_NOTIFIER_ENABLED=false

Testing

phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email thomasjohnkane@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

You can’t perform that action at this time.