Download the PHP package halilcosdu/laravel-slower without Composer

On this page you can find all versions of the php package halilcosdu/laravel-slower. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-slower

# Laravel Slower **Find your slowest database queries — and let AI tell you how to fix them.** halilcosdu%2Flaravel-slower | Trendshift [![Latest Version on Packagist](https://img.shields.io/packagist/v/halilcosdu/laravel-slower.svg?style=flat-square)](https://packagist.org/packages/halilcosdu/laravel-slower) [![Total Downloads](https://img.shields.io/packagist/dt/halilcosdu/laravel-slower.svg?style=flat-square)](https://packagist.org/packages/halilcosdu/laravel-slower) [![PHP Version](https://img.shields.io/badge/PHP-8.3%2B-777BB4?style=flat-square&logo=php&logoColor=white)](https://www.php.net/) [![Laravel](https://img.shields.io/badge/Laravel-11--13-FF2D20?style=flat-square&logo=laravel)](https://laravel.com/) [![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE.md)

Laravel Slower watches every query your application runs, captures the ones that cross your threshold, and uses AI to recommend indexes and query rewrites. It speaks to every major LLM — OpenAI, Anthropic (Claude), Google Gemini, or any custom/self-hosted model — through one official package. And since v2.3 it ships with a built-in dashboard: install the package and you have a full slow-query UI at /slower, with zero frontend work — no npm, no CDN, no assets to publish.

Contents

Features

How it works

  1. Capture. A DB::listen hook times every query. Anything slower than threshold (ms) is written to the slow_logs table with its SQL, bindings, connection, a fingerprint (so repeats group together) and its origin (route/job/command + code location). Faster queries are ignored — nothing is stored.
  2. Analyze. slower:analyze (or the dashboard's Analyze with AI button, or a queued job) sends each unanalyzed query — the parameterized SQL, table schema, indexes, origin and a safe, read-only EXPLAIN plan — to your configured LLM (OpenAI, Claude, Gemini or a custom driver).
  3. Recommend. The advice (indexes, rewrites, data-type fixes) is stored on the record and rendered as markdown in the dashboard, ready to act on.

Requirements

Installation

That's it — in your local environment, open /slower and every captured slow query is waiting for you.

Optionally publish the config file:

To enable AI recommendations, pick a provider and set its API key.

The Dashboard

The dashboard lives at /slower and gives you:

Authorizing access in production

Exactly like Telescope and Horizon, the dashboard is protected by a gate. By default it only allows access in the local environment. To open it up in other environments, define a viewSlower gate — for example in AppServiceProvider:

Dashboard configuration

Set SLOWER_DASHBOARD_ENABLED=false to remove the routes entirely, or change path to serve it elsewhere. Want to restyle it? php artisan vendor:publish --tag="laravel-slower-views".

[!WARNING] Captured SQL and bindings can contain user data, tokens and other secrets, and analyzing a query sends it (with schema context) to your AI provider as a billable API call. Keep the gate tight, and prune regularly with slower:clean.

Query groups

The same slow query rarely fires once. Every capture is fingerprinted — literals, whitespace, placeholder style and IN (...) list sizes are normalized away — so these three executions:

are one group in the dashboard's Grouped view, with an occurrence counter, average/max duration, and last-seen time — so you fix the most frequent offender first instead of scrolling through repeats. Groups are scoped per connection, and clicking one drills down to its individual events.

Fingerprints are computed from the parameterized SQL (never from real values) and the algorithm is versioned. Upgrading from an earlier version? Fingerprint your existing records once:

Origin context

"Which query is slow" is only half the answer — where it comes from is the half you can act on. Each capture records its origin automatically:

Execution What gets recorded
HTTP request route name, URI pattern, Controller@action
Queue job the job class
Artisan command the command name
All of the above the first file:line of your application code in the stack

The origin is shown on the query detail page and included in the AI prompt — which turns generic advice into "add ->with('items') to the query in OrderController@index".

Two privacy notes, both deliberate defaults:

The backtrace is taken only for queries that already crossed the threshold (so there is no per-query overhead), with DEBUG_BACKTRACE_IGNORE_ARGS — argument values never enter the trace.

Production controls

Designed to be left on under real traffic:

Privacy: what reaches your AI provider

The AI payload is safe by default — this is the exact contract:

Payload part Sent by default? Contains
Parameterized SQL (... where id = ?) ✅ yes query shape, no values
Schema & indexes of referenced tables ✅ yes column names/types, index definitions
Origin context ✅ yes (when captured) route/job/command, code location — a captured user id is never forwarded
EXPLAIN output ✅ yes (configurable) the plan — may echo literal values on some drivers
Raw SQL with real values ❌ opt-in literals: emails, tokens, ids
Bindings ❌ opt-in the actual parameter values

If your provider needs the real values for better advice, opt in explicitly — and put a redactor in front for defense in depth:

A misconfigured redactor (a class that doesn't implement the contract) throws instead of silently passing secrets. The redactor covers every outbound path — raw SQL, bindings, and the EXPLAIN plan (which can echo literal values on some drivers) — so a configured redactor is applied consistently. Without a redactor, set SLOWER_AI_RECOMMENDATION_USE_EXPLAIN=false in strict environments to keep plan literals out of the payload.

Queued analysis

An LLM round-trip takes seconds; by default Slower analyzes synchronously (no worker needed). On any app with a queue, flip one variable and analysis becomes background work:

Events

Slower ships events, not notification channels — wire them to whatever your team uses:

A complete Slack alert in ~15 lines — listen for first-seen shapes and notify:

Configuration

This is the full contents of the published config file:

A few keys worth tuning:

AI providers

Slower talks to every major LLM through one official package — Prism. There are no provider credentials in Slower's own config: you pick a provider with a single variable, and Prism reads the key from its own config (config/prism.php), which in turn reads the conventional environment variables.

ai_service Default model
openai (default) gpt-5.4-mini
anthropic claude-haiku-4-5
gemini gemini-2.5-flash
any other Prism provider you must set the model

Override any default with SLOWER_AI_RECOMMENDATION_MODEL.

[!NOTE] Upgrading from an OpenAI-only version? Nothing to change — Prism reads your existing OPENAI_API_KEY, and a boot-time bridge still honors a legacy slower.open_ai.api_key.

Below is the exact setup for each major provider. In every case only two lines are required — SLOWER_AI_SERVICE and the provider's API key; everything else is an optional override, shown commented out with its default value.

OpenAI

Get a key at platform.openai.com.

Anthropic (Claude)

Get a key at console.anthropic.com.

Google Gemini

Get a key at aistudio.google.com.

Self-hosted & OpenAI-compatible (Ollama, LM Studio, OpenRouter, Groq, …)

Any Prism provider works. These have no built-in default model, so you must name one:

A fully custom driver

For a bespoke backend, register a driver in a service provider — no HTTP code required from Slower:

Then set SLOWER_AI_SERVICE=my-llm.

[!TIP] Model ids move fast. If a default drifts, pin the current low-cost model for your provider with SLOWER_AI_RECOMMENDATION_MODEL. AI requests time out after Prism's default of 30 seconds — raise it with PRISM_REQUEST_TIMEOUT (seconds) for very large schemas or slower models.

Commands and scheduling

Run them on a schedule so analysis and retention take care of themselves:

Programmatic usage

Everything the dashboard does is available through the Slower facade and the SlowLog model.

Because slow queries are plain Eloquent records, you can query and act on them however you like:

Example recommendation 1. Indexing: consider adding a composite index on `product_id`, `price`, and `discount_total`: 2. Data types: remove the quotes around numeric comparisons so the index can actually be used: 3. Statistics: run `ANALYZE product_prices;` so the query planner has fresh statistics to work with.

Development and testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of laravel-slower with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^11.0 || ^12.0 || ^13.0
prism-php/prism Version ^0.100.1
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package halilcosdu/laravel-slower contains the following files

Loading the files please wait ...