halloverden/symfony-doctrine-sql-logger-bundle
A Symfony bundle that logs Doctrine SQL queries, helping you inspect database activity during development and debugging. Integrates with Symfony's logging to capture executed queries and their parameters.
Architecture fit. This is a Symfony bundle, not a Laravel package. It ships a Bundle class plus a DI extension and service definitions wired into Symfony's container/event system, targeting Doctrine DBAL — a data layer Laravel does not use by default. A Laravel application runs Eloquent over Illuminate\Database, so there is no natural registration point for a Symfony bundle. Fit is therefore low as a direct dependency, but moderate as a reference implementation: the value is the technique (SQL + bound-parameter interpolation, caller backtrace capture, log-level heuristics), which maps cleanly onto Laravel's DB::listen, the QueryExecuted event, or a Doctrine middleware if we already run Doctrine via laravel-doctrine.
Integration feasibility. Direct composer require into a Laravel app is a non-starter — the bundle's DependencyInjection\*Extension and Resources/config/services.* are inert outside Symfony's kernel. Feasible paths, in order of effort:
ServiceProvider that registers a DB::listen callback, reusing the bundle's parameter-binding and backtrace approach.laravel-doctrine/orm, port the bundle's config to a Laravel provider and register it as a DBAL Middleware (not SQLLogger — see risk below).Reading the source is cheap (small codebase, MIT), so a 2–3 day spike can confirm whether the formatter is worth lifting wholesale.
Technical risk.
SQLLogger and DBAL 4 removed it in favour of Middleware. A bundle whose name/history centres on "SQL logger" may target the deprecated API. This is a first-order verification question.Key questions for the spike.
SQLLogger or Middleware-based?null, arrays for IN)?Stack fit. Assume a standard Laravel 10/11 app on Eloquent + MySQL/Postgres. Nothing from the bundle loads; only its design transfers. The Laravel-native equivalent is a DB::listen(fn (QueryExecuted $q) => ...) listener registered in a dedicated, toggleable service provider, reusing the bundle's interpolation routine. If the platform is polyglot (Symfony services alongside Laravel), the bundle may be deployable as-is only in the Symfony half — treat those as two separate solutions.
Migration path. Vendor the interpolator rather than depend on the repo: copy the formatting class under our namespace, keep MIT attribution, and wrap it behind an internal interface (SqlLogFormatter) so it can be swapped. This converts an unmaintained third-party dependency into ~150 lines of owned code — the correct trade at this adoption level.
Compatibility. Pin to our supported PHP/Laravel matrix and add contract tests for: named vs. positional bindings, DateTimeInterface, booleans, null, binary, and large IN lists. If Doctrine is in play, target DBAL 3 Middleware and explicitly exclude DBAL 4 until verified. Avoid the SQLLogger path entirely.
Sequencing.
DB::listen listener with interpolation in a non-prod branch.debug with sampling rather than at info for all queries.Maintenance. As a dependency: unquantifiable risk (single maintainer, no dependents, stale-by-default). As vendored code: low — a small, self-contained formatter we own, with no upstream upgrade treadmill. Budget a few days per year plus test upkeep; the real cost is the redaction policy, which must be reviewed like any data-handling control.
Support. No vendor, no SLA, no community. Escalation = we read the source ourselves, which is realistic here given size. Document the fork origin and MIT obligations.
Scaling. Backtrace capture and per-query string interpolation are the scaling levers. Under high QPS, synchronous interpolation on the request path adds measurable CPU and, if log sinks are slow, latency. Mitigate with: sampling (e.g. 1–5% of queries), slow-query-only mode above a threshold, async log shipping, and structured context rather than pre-formatted strings so log processors can redact downstream.
Failure modes.
Ramp-up. Low for any PHP engineer: the source is small and the concept (interpolate bindings into SQL, attach caller context) is widely understood. Half a day to read, one to two days to a working Laravel listener. The non-obvious onboarding burden is the redaction policy and the on-call playbook for "why is log volume up" — both should be written before enablement.
TPM recommendation. Do not adopt as a runtime dependency. Use it as a design input to build a first-party, flag-gated, redaction-safe SQL logging capability in the Laravel stack; the high opportunity score points at a genuine gap, but the 0.105 health score says the artifact is not the answer.
How can I help you explore Laravel packages today?