topthink/think-trace
topthink/think-trace adds a lightweight trace panel to ThinkPHP applications, displaying request parameters, SQL queries, errors, and execution timing during development. Use it to inspect request flow, diagnose issues, and spot performance bottlenecks without external debugging tools.
Verdict up front: topthink/think-trace is not a Laravel package and cannot be dropped into a Laravel application. It is a debug toolbar for ThinkPHP 6+, published by Topthink (the framework vendor itself) under Apache-2.0. This assessment therefore evaluates it as (a) a candidate for any ThinkPHP services in the estate, and (b) a design reference for Laravel-side tooling.
Architecture fit
| Dimension | Assessment |
|---|---|
| Target framework | ThinkPHP 6/8 only. Registers as a ThinkPHP Service and injects a middleware into the ThinkPHP HTTP kernel pipeline. |
| Laravel compatibility | None. No service provider, no facade, no Illuminate\ dependencies, no Laravel middleware contract. |
| Coupling surface | Deep: relies on think\App, think\Middleware, think\Response/think\response\Html, think\facade\Db query logging, and ThinkPHP's event dispatcher. |
| Runtime scope | Development/diagnostic only. Injects a rendered HTML bar into the response body. |
| License | Apache-2.0 — permissive, no legal friction, patent grant included. |
The package's value proposition is narrow and well executed for its target: request timing, memory, SQL log, loaded files, and config visibility rendered as a footer bar. That is functionally the ThinkPHP equivalent of Laravel Debugbar. It is not portable, and a port would be a rewrite, not an integration.
Integration feasibility
composer require --dev topthink/think-trace, and it is typically already proposed by the ThinkPHP application skeleton. Configuration is a single config/trace.php-style file gating 'type' => 'Html' and the 'trace' toggle.topthink/framework conventions rather than through organic Composer discovery, so low star count reflects distribution model, not abandonment. The July 2025 release date confirms active vendor maintenance.Technical risk
Content-Security-Policy and can be stripped or mangled by CDNs/reverse proxies.Key questions to answer before any adoption decision
APP_DEBUG reliably false in every non-local environment, and is that enforced by config management rather than developer convention?barryvdh/laravel-debugbar and/or Laravel Telescope as the sanctioned equivalent, so we are not evaluating a foreign-framework tool to fill a gap we already filled?Stack fit
There is no stack fit for Laravel. The correct framing for a Laravel-centric organization is substitution, not integration: adopt the native equivalent and treat think-trace purely as a capability benchmark.
| Need | Laravel-native answer | Notes |
|---|---|---|
| Request/SQL/timeline debug bar | barryvdh/laravel-debugbar |
Mature, high adoption, active, first-class Laravel support. |
| Persistent request/query/exception telemetry | Laravel Telescope | Non-dev environments included; complements, not replaces, the bar. |
| Query profiling in tests | DB::listen, assertQueryCount, Pulse |
Built in. |
Migration path (for a ThinkPHP footprint being consolidated onto Laravel)
think-trace is present and enabled. Assume it is; the skeleton pulls it.think-trace configuration or customization. It is a terminal-state dependency for services that are being retired.topthink/think-trace from require-dev in the final commit of each migrated service rather than carrying it into an archived branch.Compatibility and sequencing
require-dev, gate on APP_DEBUG and APP_ENV=local, and add a CI check that fails if a debug toolbar package appears in require (non-dev).require-dev only; gate the bar on APP_DEBUG && APP_ENV === 'local'; ensure the middleware is bypassed for requests whose Accept header does not include text/html; deploy behind a local-only hostname or VPN.Maintenance
Low effort but non-zero. The vendor ships releases on its own cadence (latest July 2025), so there is no active maintenance burden — but also no leverage. Upgrades are driven by ThinkPHP major versions; if the framework moves, the toolbar must move with it. Apache-2.0 means we can fork if the vendor ever stops, but a fork of a low-signal package is a poor use of engineering time.
Support
Weak external support surface. Small repository, low community volume, Chinese-first documentation. Internal support burden falls entirely on whichever engineer owns the ThinkPHP service. Escalation path is effectively "read the source" — acceptable for a dev-only tool, unacceptable if anyone starts treating it as load-bearing.
Scaling
Not applicable in the production sense — it must never serve production traffic. Development scaling considerations: full SQL log capture grows memory linearly with query count, so pages issuing hundreds of queries will show measurable slowdown from the tool itself. On multi-tenant or high-cardinality local datasets, the file-list panel can become the dominant cost.
Failure modes
| Failure | Symptom | Blast radius | Mitigation |
|---|---|---|---|
| Enabled in production | SQL, paths, config leaked to any visitor | Severe, and often silent | Config-management enforcement of APP_DEBUG=false; CI assertion; external scan for the trace bar's DOM markers |
| Non-HTML response injection | Corrupted JSON/downloads | Moderate | Accept-header gate; disable for API routes |
| Strict CSP | Bar invisible or page broken | Low | Document exemption, or accept the bar simply will not render |
| Response buffering interaction | Truncated or double-encoded output | Moderate | Keep out of any streaming/SSE path |
| Framework upgrade drift | Bar renders wrong data or throws | Low (dev only) | Pin versions; re-validate on ThinkPHP majors |
Ramp-up
Effectively zero for a ThinkPHP developer — install and it works. For a Laravel-only team, ramp-up is irrelevant because the tool is not adoptable; the useful transfer is conceptual (what signals a debug bar should surface), and the team should invest that learning curve in Debugbar and Telescope instead, where the knowledge compounds across every service we own.
TPM recommendation
Do not adopt as a Laravel dependency — no path exists. Treat it as out-of-scope unless a ThinkPHP service is in the portfolio, in which case permit it strictly as a require-dev, local-environment-only convenience with a config-management guard against production activation. Fund the Laravel-side equivalent (Debugbar + Telescope) as the standard and close this evaluation.
How can I help you explore Laravel packages today?