- What does Laravel Slower actually do for a Laravel application?
- Laravel Slower hooks into Laravel's database layer and persists any query that exceeds a configurable duration threshold into a dedicated slow_logs table. An artisan command then enriches those rows with AI-generated advice covering suggested indexes, query rewrites, schema context and existing index definitions. It is a side-car observability package rather than a framework extension, so it requires no changes to your controllers, models or application code and can be removed without refactoring. Unlike Telescope, Pulse or Debugbar, which show you that a query is slow, Slower is aimed at proposing concrete fixes you can review.
- How do I install and configure Laravel Slower?
- Install it with composer require halilcosdu/laravel-slower, run the package's two vendor:publish calls to get the config file and migration, then run php artisan migrate to create the slow_logs table. You enable capture with environment variables such as SLOWER_ENABLED, SLOWER_THRESHOLD, SLOWER_AI_RECOMMENDATION and your provider key like OPENAI_API_KEY, and you schedule the package's two artisan commands, including slower:analyze, in your console kernel or routes/console.php. Analysis can be queued so AI latency and API throttling never sit on a request path. Most competent Laravel engineers report roughly half a day to a day of work end to end.
- Which Laravel and PHP versions does Laravel Slower support?
- The README badges list PHP 8.3+ and Laravel 11 through 13, and the package follows the conventional service provider plus publishable config and migration pattern. Technical evaluations describe CI coverage across Laravel 10.x through 13.x, and openai-php/laravel is pinned to ^0.18.0. Check the composer.json constraints for your exact PHP and Laravel combination before adding it to a legacy application, since the README and the evaluation notes differ slightly on the minimum PHP version.
- Which AI providers can Laravel Slower use for query recommendations?
- The package speaks to every major LLM through one official package: OpenAI, Anthropic Claude, Google Gemini, or any custom or self-hosted model you point it at. Provider selection and credentials are handled through configuration and environment variables, alongside switches such as SLOWER_AI_RECOMMENDATION. If you need a self-hosted model for data residency reasons, the custom provider path is the relevant option to evaluate first.
- What data does Laravel Slower send to the AI provider, and is it safe for production?
- Recommendations are generated by sending SQL text, query bindings, schema context and existing index definitions to your chosen AI provider, and since v2.0.0 the request also includes EXPLAIN ANALYZE output. The package also stores bindings in plaintext in the slow_logs table, so both the third-party egress and the local storage need review. In regulated or consumer-data environments, that data-governance sign-off, not the engineering work, tends to be the critical path. Confirm whether binding redaction exists before persistence and before the request, or plan to implement it yourself.
- Why does Laravel Slower show no slow queries after I install it?
- The default SLOWER_THRESHOLD is 10000 milliseconds, so only queries over ten seconds are captured out of the box. In most OLTP applications that will miss the queries actually driving p95 latency, such as the routine 200 millisecond ones. Lower the threshold to something meaningful for your workload and watch the /slower dashboard for a day or two before drawing conclusions. A naive deployment can otherwise produce a false 'no slow queries' result.
- Does Laravel Slower apply the recommended indexes automatically?
- No. The package is advisory only: it writes recommendations for you to review, and it never creates an index or rewrites a query on its own, which is the right default for production. AI output is not validated, and the README's own example notes that composite index column ordering depends on selectivity, which a model cannot reliably infer without statistics. Treat every recommendation as a draft that requires a developer and a query plan review before it reaches a migration.
- Is EXPLAIN ANALYZE in Laravel Slower safe to run against writes and heavy queries?
- ANALYZE actually executes the statement, so this is a real production concern rather than a theoretical one. The package defaults ignore_insert_queries to true, but how updates, deletes and multi-statement queries are scoped is not documented, and there is no documented statement timeout or read-only connection option. Before enabling analysis on a busy database, verify the behaviour on a replica or staging environment and confirm which statement types are excluded. If your workload does heavy writes, this is one of the questions worth raising with the maintainer directly.
- Do I need to build frontend assets to use the Laravel Slower dashboard?
- No. Since v2.3 the package ships a built-in dashboard available at /slower, with duration bars, filters, query groups, origin context and AI analysis status. There is no npm step, no CDN dependency and no assets to publish, so the UI works as soon as the package is installed and migrated. Make sure the route is protected by your application's auth or IP allow-listing middleware before enabling it in production.
- Is Laravel Slower actively maintained, and what should I plan for?
- It is a single-maintainer MIT package with around 414 GitHub stars and zero dependents, and its documentation page is still listed as a roadmap item. The small, forkable codebase mitigates the bus-factor risk, but you should confirm the maintainer's commitment level for v2 and whether the planned premium Auto Indexer could introduce future feature gating or a licensing dependency. Also ask about retry and backoff behaviour for slower:analyze when the AI provider throttles, and whether failed rows stay marked as is_analyzed=false so they can be safely replayed.