alkhvalko/symfony-roadrunner-dumper
Installation:
composer require --dev alshenetsky/symfony-roadrunner-dumper "^1.0"
Ensure the package is listed under require-dev in composer.json.
Enable the Bundle:
Add the bundle to your Symfony kernel’s bundles.php (or equivalent configuration):
return [
// ...
Dev\RoadRunnerDumperBundle::class => ['all' => true],
];
First Use Case:
Replace dd() with \dev\dd() in your Symfony/Roadrunner application:
use function Dev\RoadRunnerDumper\dd;
dd($someVariable); // Works seamlessly in Roadrunner
Debugging HTTP Requests:
Use \dev\dd() in Symfony controllers or middleware to inspect request/response objects without breaking Roadrunner’s output buffer:
public function index(Request $request): Response
{
\dev\dd($request->query->all()); // Dumps without worker errors
return new Response('OK');
}
Queue Workers:
Debug queue jobs or workers by dumping variables in handle() methods:
public function handle()
{
\dev\dd($this->job->payload); // Works in Roadrunner queue workers
}
CLI Commands:
Use \dev\dd() in Symfony console commands for debugging:
protected function execute(InputInterface $input, OutputInterface $output): int
{
$data = $this->fetchData();
\dev\dd($data); // Works in CLI context
return Command::SUCCESS;
}
VarDumper for consistent output formatting.dd() with \dev\dd() for Roadrunner compatibility.Worker Errors:
dd() directly in Roadrunner may trigger worker error: invalid data found in the buffer.\dev\dd() instead of dd() in Roadrunner contexts.Output Buffering:
\dev\dd() is called in a context where output is flushed (e.g., not inside nested async calls).Development Only:
require-dev, so it won’t be available in production.\dev\dd() calls before deploying to production.rr.log) for buffer-related errors.Custom Formatters:
Extend Symfony’s VarDumper to add custom handlers for your domain objects:
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
// Register a custom cloner in services.yaml
services:
App\CustomCloner:
tags: [symfony.var_dumper.cloner]
Environment-Specific Dumping:
Conditionally enable \dev\dd() based on environment variables:
if (app()->environment('local')) {
\dev\dd($variable);
}
Roadrunner Configuration:
Adjust Roadrner’s worker settings to handle output more gracefully (e.g., increase buffer limits in rr.yaml).
How can I help you explore Laravel packages today?