dazza-dev / pulse-duplicate-queries
Laravel Pulse Duplicate Queries provides a ready-to-use list of duplicate queries for your Laravel application.
Requires
- php: >=8.1
- laravel/framework: ^10.0|^11.0|^12.0
- laravel/pulse: ^1.0
Requires (Dev)
- larastan/larastan: ^2.0
- laravel/pint: ^1.18
- orchestra/testbench: ^8.27
README
A Laravel Pulse recorder and card package designed to monitor and visualize database query duplication per HTTP request.
Installation
Require the package with Composer:
composer require dazza-dev/pulse-duplicate-queries
Register the recorder
Right now, in each request, the system will check how many queries are being executed and how many of them are duplicated. To run the checks you must add the DuplicatedQueriesRecorder
to the config/pulse.php
file.
'recorders' => [ \DazzaDev\PulseDuplicateQueries\Recorders\DuplicateQueriesRecorder::class => [ 'enabled' => env('PULSE_DUPLICATED_QUERIES_BY_REQUEST_ENABLED', true), 'sample_rate' => env('PULSE_DUPLICATED_QUERIES_BY_REQUEST_SAMPLE_RATE', 1) ], ]
You also need to be running the pulse:check
command.
Add to your dashboard
To add the card to the Pulse dashboard, you must first publish the vendor view.
Then, you can modify the resources/views/vendor/pulse/dashboard.blade.php
file:
<livewire:duplicate-queries cols='4' rows='2' />
Contributions
Contributions are welcome. If you find any bugs or have ideas for improvements, please open an issue or send a pull request. Make sure to follow the contribution guidelines.
Author
Laravel Batch Validation was created by DAZZA.
License
This project is licensed under the MIT License.