Weave 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

Trap Laravel Package

buggregator/trap

Buggregator Trap transforms PHP debugging: drop-in Symfony VarDumper extensions, helper functions for any Buggregator server, and a lightweight local server that needs no Docker. Install as a Composer dev dependency; pairs with the Buggregator PHPStorm plugin.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

Trap is a developer-experience layer, not an application dependency. It installs as require-dev, hooks into symfony/var-dumper (which Laravel already pulls in via laravel/framework), and adds three things: (1) a set of global helpers (trap(), tr(), td()) that mirror dump()/dd() semantics, (2) enhanced casters/renderers for objects like protobuf messages and binary payloads, and (3) a single-binary, pure-PHP "mini Buggregator server" that multiplexes multiple protocol handlers (VarDumper, Monolog, Sentry, SMTP, HTTP dumps, Ray, raw data) across ports 9912/9913/1025/8000. Architecturally this is a local concern: it has no place in the request lifecycle of a production Laravel app, and its value is realized only on a developer workstation or an ephemeral CI/debug environment.

The fit with a modern Laravel team is strong but narrow. It is strongest where the team already relies on dump()/dd() and Monolog for everyday diagnosis and where Docker is not present or is heavyweight (Herd/Valet/native PHP setups, Windows/WSL workflows, constrained CI runners). It is weakest where the team has already standardized on paid tooling (Ray) or on Docker Compose-based infrastructure (Sail + Mailpit), because Trap overlaps rather than complements those stacks.

The 1.18.0 release does not change this architecture, but it does re-anchor the baseline: Trap now requires PHP 8.2. That aligns with Laravel 11/12 and with where most active Laravel teams already are, so for the majority the floor is invisible. For any team still on PHP 8.1 — most commonly a Laravel 10 app that has not yet moved — 1.18.x is simply unavailable, and 1.17.x becomes the effective ceiling. This is the first release in the observed history that can exclude an otherwise-interested team, and it should drive a PHP-version pre-flight check before anything else in the rollout.

Integration feasibility

Low effort, high reversibility. composer require --dev buggregator/trap -W is the entire install in the common case; the VarDumper enhancements are active with no code change, and the server starts with vendor/bin/trap. Two alternative distribution channels meaningfully de-risk adoption: a global binary via dload and a signed Phar via phive/wget. The Phar path is the escape hatch for the most common failure mode — dependency resolution conflicts between Trap's own requirements and the host application's locked set — and should be the default recommendation for any Laravel app with a large or pinned dependency graph.

New in this window: the package's own composer.json PHP constraint is now the gating factor rather than the host app's dependency graph. A Composer install on PHP 8.1 will fail resolution cleanly (good — no silent breakage), whereas the Phar path will refuse to boot. Both are legible failures, but they mean the "does it install?" question is now answered by php -v before it is answered by Composer.

Technical risk

  • PHP 8.2 floor (new, highest-impact). Trap 1.18.0 requires PHP 8.2, enforced at install time and, per the changelog, in its test matrix (migrated to Testo in the same PR). Any Laravel 10 / PHP 8.1 environment is capped at 1.17.x and will stop receiving fixes, including the security-adjacent parser fixes below. Treat this as a hard compatibility gate, not a soft preference.
  • Dependency surface. The -W ("allow updates") flag is convenient but can silently move other locked packages during install; in a Laravel repo this should be treated as a controlled operation, ideally avoided entirely by using the Phar. Still true, and now slightly more consequential: a -W install can also drag the host app's PHP platform constraint into view mid-operation.
  • Port contention. The default port set collides with common Laravel tooling: 8000 with php artisan serve, 1025 with Mailpit/MailHog SMTP, 9912/9913 with existing Buggregator installs. This remains the most likely day-one friction point and is fully mitigable via TRAP_TCP_PORTS, TRAP_TCP_HOST, and TRAP_UI_PORT.
  • Global namespace impact. Installing the package adds trap(), tr(), td() globally and mutates $_SERVER['REMOTE_ADDR']/REMOTE_PORT when unset. Unchanged by this release; collision probability with Laravel helper names remains low but should be confirmed.
  • Maturity/supply chain. Unchanged fundamentals — 276 stars (previous snapshot), single primary maintainer, now Boosty-funded (sponsor links moved from Patreon to Boosty in this release, a funding-platform migration worth noting for anyone sponsoring). BSD-3-Clause remains permissive and commercially safe. One positive movement: the 1.18.0 changelog is materially more legible than prior releases — 13 bug fixes each referencing an issue/PR number, grouped by area. That is a real improvement in release hygiene, even if prose is still terse.
  • Stability signal from this release. The bug-fix payload is almost entirely in the protocol parsers and senders — Sentry envelope item length handling, Sentry attachments, base64 chunk boundary decoding, HTTP frame uploaded-file reconstruction, BodyToFileSender batching and error types, profiler tree parenting. This is the signature of a tool being exercised against real payloads rather than one that is feature-frozen; the fixes resolve genuine data-corruption-class bugs (dropped Sentry items, merged body files, byte-count-vs-stream mixups) that would have shown up as "my dump looked wrong." Good signal for the parsers, but also evidence that the parser surface is still settling — pin, don't float.
  • Environment gaps. Partially answered: PHP 8.2 minimum is now explicit. Still open: required extensions (sockets/pcntl/posix) and behavior under long-running workers (Octane/Swoole/queue workers), plus native Windows support versus WSL-only. The Sentry/SMTP/HTTP handler work in this release increases the number of code paths that touch sockets and streams, which raises the value of testing on the least-common-denominator workstation.
  • Production exposure. The local server has no evident auth model. Defaults bind 127.0.0.1, but the tool must be explicitly banned from shared/staging hosts. Improved in this release: trap run now reports startup errors and exits non-zero — which is precisely the behavior you want if anyone ever does wire it into a script or CI job, because failure becomes loud instead of a hang.

Key questions

  1. What is the minimum supported PHP version? Answered in 1.18.0: PHP 8.2. Follow-up: is 1.17.x still receiving backported fixes, and for how long?
  2. Does the Trap server run natively on Windows, or only under WSL — and does the PHP 8.2 floor change extension availability on Windows builds?
  3. If the Trap server is not running, do the VarDumper extensions degrade silently to stock behavior, or do they throw/slow the request?
  4. Does any of this work inside Laravel Octane/Swoole workers, and are there known memory-retention issues?
  5. How does -W interact with a committed composer.lock in practice — what exactly can it update?
  6. What is the support/roadmap commitment behind the --ui feature (still marked "in development") and the project's long-term governance, now that funding has moved to Boosty?
  7. Can senders be enforced organizationally (e.g., -sfile only) so nobody accidentally ships a dev-server dependency into CI artifacts — and should we now standardize on trap run exiting non-zero as a CI guardrail?
  8. Is there any signed-release / provenance story beyond the Phar GPG signing mentioned in changelog history?

Integration Approach

Stack fit

Trap slots in as a local diagnostics utility alongside, not inside, the Laravel runtime. The zero-config payoff is that existing dump()/dd() calls immediately render better in the terminal once the package is present — no refactor, no new API to learn. Beyond that, it consolidates several things a Laravel team typically runs separately: a VarDumper server, an SMTP catcher (Mailpit/MailHog) for Mail::fake()-adjacent manual testing, a place to eyeball Monolog output, and a receiver for outgoing HTTP client dumps. For a team already paying for Ray, Trap is a partial substitute (it can receive Ray payloads) rather than a replacement — position it as "reduce tool sprawl and license cost," not "replace your IDE workflow."

The PHP 8.2 floor actually tightens stack fit in a helpful way: it now matches the same baseline as Laravel 11/12, so a team that has completed the Laravel 11+ upgrade inherits Trap compatibility for free. The package stops being an independent variable and starts tracking the framework's own platform policy.

Migration path

Add a step zero: PHP version audit across the estate. If the fleet is uniformly PHP 8.2+, proceed with the standard rollout. If any app is pinned at 8.1 (typically Laravel 10 with a shared base image), decide explicitly between (a) pinning Trap to ^1.17 for those apps with the understanding that fixes stop flowing, or (b) excluding them from the rollout until their framework upgrade lands. Do not let a mixed fleet silently install two different Trap majors across repos without documenting it.

Otherwise unchanged: start with a Phar-first rollout for anyone on a large monorepo or with strict lockfile discipline, and offer the Composer dev-dependency path for smaller apps. Introduce the trap() family as an additive convention: keep dump()/dd() legal, add tr()/td() as the recommended shortcuts in onboarding docs, and do not mass-rewrite existing debugging calls. If the team currently runs Mailpit in Sail, keep it and use Trap only for VarDumper/Monolog in phase one; retire Mailpit only after the SMTP trap and mail-to-file sender have been validated against the team's actual mail templates (including multi-recipient To: handling). If the team uses Ray, run both in parallel for a sprint and let individual developers opt out of Ray.

Compatibility

Pin the version in composer.json ("buggregator/trap": "^1.18", or "^1.17" where PHP 8.1 persists) and commit the lockfile; do not use floating constraints for a single-maintainer tool. Confirm the host app's composer.json platform config declares PHP ≥ 8.2 before bumping, and treat the 1.17 → 1.18 step as a platform-breaking minor — the semver major did not move, the platform requirement did. Explicitly test the install on the team's least-common-denominator workstation OS. Where extensions are missing, fall back to the Phar or to -sfile/-sconsole senders that don't require the socket server.

Sequencing

  1. PHP pre-flight (hours): inventory PHP versions across all Laravel apps; classify into "8.2+ → current Trap" and "8.1 → pinned or excluded." Resolve before any install work.
  2. Spike (1–2 days): one senior developer installs via Phar and via Composer on a representative Laravel app; validate VarDumper rendering, trap() options (->depth(), ->times(), ->once()->if(), ->return()), and Monolog capture.
  3. Port hygiene: define a project-standard .env-adjacent snippet (TRAP_TCP_PORTS, TRAP_TCP_HOST, TRAP_UI_PORT) and document it, resolving the 8000/1025 collisions up front.
  4. Tooling wiring: add a Composer script ("trap": "vendor/bin/trap") and a Make/Artisan-adjacent alias; add a short docs/local-debugging.md with a cheat sheet and the "never on shared hosts" rule.
  5. Pilot (1 sprint): 3–5 developers, PhpStorm plugin optional, collect friction notes. Include at least one developer who exercises Sentry capture and the mail-to-file/body-to-file senders, since that is where the 1.18.0 fixes landed.
  6. Standardize: add to the onboarding checklist, decide on Ray retention, decide whether the Phar or Composer path is canonical, and adopt a Dependabot/Renovate grouping rule for dev dependencies.
  7. Optional CI use: only as a manually triggered debug job, and only now that trap run exits non-zero on startup failure. Do not add the Trap server to the standard pipeline.

Operational Impact

Maintenance

Maintenance cost remains genuinely low because the blast radius is a dev dependency: no runtime SLA, no production rollback path, no data migration. The recurring work is version pinning and periodic review of a fast-moving release stream. Budget roughly a few hours per quarter for a maintainer to bump, smoke-test, and update the internal cheat sheet — but add one explicit rule learned from this release: read the changelog for platform requirements before bumping, because a minor version can raise the PHP floor. The upgrade validation method is unchanged (run the tool, don't just read notes), and the notes themselves are now worth reading, which lowers the cost slightly. The heavier long-term cost is still tooling portfolio maintenance if the team keeps Ray and Mailpit alongside Trap — decide deliberately rather than accumulating all three.

Support

Community support only: GitHub issues and Discord, funded through Boosty (migrated from Patreon in this release — update any internal sponsor documentation and procurement records that reference the old platform; recurring sponsorship flows may need re-authorization). Small maintainer base, unchanged. For a commercial team this argues for (a) pinning, (b) sponsoring the project if it becomes load-bearing for onboarding, and (c) keeping the Phar fallback documented so a broken Composer install never blocks a developer. Internal support burden stays minimal, though the question set shifts slightly: fewer "why didn't my dump appear" (startup failures are now loud) and more "why won't it install" (PHP 8.2 gate).

Scaling

Scaling is per-developer, not per-request: cost grows linearly with headcount and is negligible. The real scaling constraint is shared environments. Trap must be explicitly excluded from staging/shared dev hosts where an unauthenticated listener on 1025 or 8000 would be an incident. For teams running parallel local environments, port collisions scale badly — a documented per-developer port convention (or reliance on the console/file senders that avoid the socket server) is the mitigation. Long-running workers (Queues, Octane) still need a documented caveat: dump interception behaves differently when the process is not request-scoped. Note that the PHP 8.2 floor means the scaling of the rollout itself is now bounded by framework upgrade progress rather than by developer enthusiasm.

Failure modes

  • PHP version mismatch (new, most likely now): dev installs on 8.1 fail at resolution or Phar boot — mitigated by the pre-flight audit and a documented ^1.17 pin for stragglers.
  • Port collision (8000 vs artisan serve, 1025 vs Mailpit) — mitigated by env vars.
  • Composer conflict / lockfile churn from -W — mitigated by Phar or global binary.
  • Silent no-op if the Trap server isn't running and the extension doesn't fall back gracefully — validate explicitly during the spike and document "start the server first" in the cheat sheet. Partially improved: server startup failures now surface with a non-zero exit rather than a silent hang, which narrows this to the client-side no-op case.
  • Misrendered payloads (Sentry envelopes, chunked base64 bodies, HTTP frame uploads, batched body files) — several of these were real defects fixed in 1.18.0; if any team is on 1.17.x, prioritize the bump for anyone using Sentry or body-to-file senders.
  • Namespace collision on trap()/tr()/td() or $_SERVER mutation affecting app code — low probability, cheap to check.
  • Accidental promotion to a shared host — mitigated by keeping it in require-dev, a CI check that asserts it's absent from production lockfiles/images, and a written policy.
  • Phar trust — verify signature/checksum from the release page rather than blindly consuming latest/download.

Ramp-up

Very shallow and effectively unchanged. Any Laravel developer who knows dump()/dd() is productive within 15–30 minutes; trap() is intentionally a near-drop-in with a small, memorable option set (depth, times, once, if, return), and tr()/td() are one-line shortcuts. This release also fixed tr() delta formatting over one minute, so the timing helper is now trustworthy for anything slower than a minute — worth calling out to developers who abandoned it after seeing wrong numbers. The only real learning curve is operational, not syntactic: which ports are in use, which sender to pick (console, server, file, mail-to-file), and when to prefer the Phar. A one-page cheat sheet plus a five-minute onboarding demo covers it. Budget a slightly longer session for whoever owns the team's local-environment standard, since they now also own the PHP-version gate and the "which Trap version per repo" question.

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.
ably/pubsub-server
mstfkhazaal/defender
mfonte/base62x
karnoweb/metapilot
tobya/bcsapiwrapper
swalker2/cpanel
vish4395/laravel-translation-manager
morningtrain/economic
teksite/systeminfo-laravel
atomcms/voting
run6/weather
siokas/laravelembeddirectives
adamlien/pkuuids
gilsonsouza/lara-doc-generator
manelgavalda/enrollment_mobile
unabomber/timezone
delatbabel/contacts
astritzeqiri/g-recaptcha
kevinongko/laravel-genode
developeruz/laravel-analytics