buggregator/trap
Buggregator Trap enhances PHP debugging with instant Symfony VarDumper integrations, handy helper functions, and a lightweight local Buggregator server (no Docker). Connect to any Buggregator server and pair with the PhpStorm plugin for a smooth workflow.
buggregator/trap is a local debugging server that integrates seamlessly with Laravel/PHP ecosystems, particularly enhancing Symfony VarDumper, Monolog, Sentry, and HTTP/SMTP debugging. It replaces or augments traditional dump()/dd() with a centralized, protocol-agnostic debugging system.trap($var)->if($condition)), making it adaptable to Laravel’s event-driven architecture.composer require --dev buggregator/trap) with zero config for basic usage. Laravel’s service provider or bootstrapping can auto-initialize the server.single, stacked) can route to trap via custom handlers.dload get trap), useful for CI/CD debugging or one-off scripts.symfony/var-dumper or monolog if not pinned strictly (mitigated by --with-all-dependencies in Composer).trap()->times(10)).9912, 9913, 8000) must be unblocked in dev environments. Conflicts with other services (e.g., Laravel Valet) can be resolved via -p flag.var_export(). Test with real payloads pre-integration.--ui=8000) is in active development—monitor for Laravel-specific quirks (e.g., CSRF, auth).trap replace Laravel Telescope or Debugbar, or supplement them? (E.g., use trap for low-level data and Telescope for HTTP requests.)trap()->if()) interact with Laravel’s event listeners or middleware?trap be disabled in production (dev-only) or used for selective logging (e.g., error paths)?trap capture failed test outputs or command-line errors for debugging? (Yes, via console sender.)-p to isolate instances.)dd()/dump() to trap()? (Provide migration guides and IDE snippets.)--ui)?trap() as a global helper (via composer.json autoloading or a macro).Monolog handler to route logs to trap (e.g., TrapHandler).App\Exceptions\Handler to trap uncaught exceptions.trap:serve command for CLI-driven debugging.trap in PHPUnit/Pest to capture test failures or assert dump outputs.ShouldQueue or Dispatchable.| Phase | Action | Tools |
|---|---|---|
| Evaluation | Install as dev dependency; test trap() vs. dd() in a sandbox project. |
composer require --dev buggregator/trap |
| Pilot | Replace dd() with trap() in critical paths (e.g., API controllers). |
IDE find/replace + trap()->return() |
| Full Rollout | Integrate with Monolog, Exceptions, and Artisan; disable in production. | Custom TrapServiceProvider |
| Optimization | Configure port isolation, conditional traps, and UI access. | TRAP_TCP_PORTS, --ui flag |
ext-protobuf (optional).trap for low-level data; Telescope for HTTP/DB.trap can replace Ray for local debugging (but lacks Ray’s remote inspection).trap in all dev machines.tr() → trap()->return()).TrapServiceProvider to config/app.php.App\Exceptions\Handler to trap exceptions.TrapHandler for Monolog:
use Buggregator\Trap\Monolog\TrapHandler;
$monolog->pushHandler(new TrapHandler());
vendor/bin/trap -sfile to failed test outputs.--ui for manual inspection of build logs.trap in .env:
TRAP_ENABLED=false
trap()->times(5) to avoid spam.buggregator/trap for breaking changes (e.g., protobuf schema updates). Pin versions in composer.json:
"buggregator/trap": "^1.13"
-p flag or TRAP_TCP_PORTS to avoid clashes.file sender to rotate dump logs (e.g., runtime/dumps/*.log).trap evolves.vendor/bin/trap --ui=8000 → Access http://localhost:8000.server sender to forward dumps to a central Buggregator instance.netstat -tulnp | grep 9912.How can I help you explore Laravel packages today?