Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Slower

Laravel Slower Laravel Package

halilcosdu/laravel-slower

Laravel Slower detects slow database queries in Laravel apps and provides actionable performance insights. It can use AI to suggest indexes and other optimizations, helping you debug and monitor query performance in production.

View on GitHub
Deep Wiki
Context7

Laravel Slower helps you find and fix slow database queries in Laravel apps. It detects queries that exceed a configurable threshold, logs them for review, and can use AI recommendations to propose indexing and other optimizations.

Use it during debugging or continuous monitoring to turn performance issues into actionable improvements—without changing your existing query code.

  • Detects and records slow queries automatically
  • Configurable enable/disable and threshold via config/env
  • Stores logs in a dedicated model/table you can customize
  • Optional AI-powered indexing and performance suggestions
  • Supports Laravel 10/11/12 and PHP 8.2+
Frequently asked questions about Laravel Slower
How do I install Laravel Slower in a Laravel 12.x project?
Run `composer require halilcosdu/laravel-slower` in your project directory. The package supports Laravel 12.x natively with no additional steps. Ensure PHP 8.2+ is installed, as it’s a requirement for Laravel 12.x compatibility.
Does Laravel Slower work with Laravel 13.x, and are there any breaking changes?
Yes, Laravel Slower fully supports Laravel 13.x with no breaking changes in v2.1.0. The package leverages updated dependencies like Orchestra Testbench 11.x and PHPUnit 11+ to ensure seamless integration with Laravel 13’s new features, including improved model events.
Can I disable AI recommendations to avoid OpenAI API costs?
Yes, set `ai_recommendation` to `false` in the published config file. This disables AI-powered suggestions entirely, preventing API calls to OpenAI while retaining slow query logging functionality. Useful for production environments where cost control is critical.
What’s the minimum query execution time threshold for logging slow queries?
The default threshold is 10,000 milliseconds (10 seconds). Adjust it in the config file under the `threshold` key to match your application’s performance needs. Lower values capture slower queries but may increase log volume.
How does Laravel Slower handle database connections in multi-environment setups?
Laravel Slower uses Eloquent’s built-in connection handling, so it respects your `.env` configuration for different environments (e.g., `DB_CONNECTION=mysql`). Ensure your `SLOWER_ENABLED` env variable is set per environment to control logging behavior.
Are there alternatives to Laravel Slower for Laravel 9.x or older projects?
Laravel Slower no longer supports Laravel 9.x or older. For legacy projects, consider alternatives like `barryvdh/laravel-debugbar` (for query inspection) or `spatie/laravel-query-logger` (for manual logging). Upgrading to Laravel 10.x first is recommended for full compatibility.
How can I customize the AI prompt for query recommendations?
The package allows custom AI prompts via the config file. Modify the `ai_prompt` key to tailor recommendations to your database schema or specific optimization goals. Test changes in a staging environment to validate the output before production use.
Will Laravel Slower impact production performance during monitoring?
Minimal impact is expected, as the package only logs queries exceeding the threshold. However, enabling AI recommendations adds latency due to OpenAI API calls. Disable AI in production (`ai_recommendation=false`) or use a staging environment for testing.
How do I test Laravel Slower in a CI/CD pipeline?
Use Laravel’s Testbench to simulate slow queries in unit tests. The package includes GitHub Actions workflows for PHPUnit 11+ and Pest, ensuring compatibility. Mock AI responses in tests to avoid OpenAI API costs during CI runs.
What happens if OpenAI’s API is unavailable or rate-limited?
The package gracefully falls back to logging slow queries without AI recommendations. Configure a retry mechanism or fallback prompts in the config to handle intermittent API issues. Monitor OpenAI’s status page for outages.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4