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

Detects slow Laravel database queries, logs them, and uses optional AI recommendations to suggest indexes and other optimizations. Configure thresholds, enable/disable monitoring, and run with Laravel 10–13 on PHP 8.2+ for actionable performance insights.

View on GitHub
Deep Wiki
Context7

Laravel Slower: Optimize Your DB Queries with AI

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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai