Weave Code
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

Symfony Roadrunner Dumper Laravel Package

alkhvalko/symfony-roadrunner-dumper

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation:

    composer require --dev alshenetsky/symfony-roadrunner-dumper "^1.0"
    

    Ensure the package is listed under require-dev in composer.json.

  2. Enable the Bundle: Add the bundle to your Symfony kernel’s bundles.php (or equivalent configuration):

    return [
        // ...
        Dev\RoadRunnerDumperBundle::class => ['all' => true],
    ];
    
  3. First Use Case: Replace dd() with \dev\dd() in your Symfony/Roadrunner application:

    use function Dev\RoadRunnerDumper\dd;
    
    dd($someVariable); // Works seamlessly in Roadrunner
    

Implementation Patterns

Workflows

  1. 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');
    }
    
  2. 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
    }
    
  3. 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;
    }
    

Integration Tips

  • Symfony VarDumper: Leverages Symfony’s built-in VarDumper for consistent output formatting.
  • Roadrunner Compatibility: Designed to bypass Roadrunner’s buffer restrictions, making it ideal for async environments.
  • Laravel Alternative: If migrating from Laravel, replace dd() with \dev\dd() for Roadrunner compatibility.

Gotchas and Tips

Pitfalls

  1. Worker Errors:

    • Issue: Using dd() directly in Roadrunner may trigger worker error: invalid data found in the buffer.
    • Fix: Always use \dev\dd() instead of dd() in Roadrunner contexts.
  2. Output Buffering:

    • Issue: Roadrunner’s output buffering may suppress dump results if not handled properly.
    • Fix: Ensure \dev\dd() is called in a context where output is flushed (e.g., not inside nested async calls).
  3. Development Only:

    • Issue: The package is marked as require-dev, so it won’t be available in production.
    • Fix: Remove or comment out \dev\dd() calls before deploying to production.

Debugging

  • Check Output: If dumps aren’t appearing, verify Roadrunner’s worker logs (rr.log) for buffer-related errors.
  • Symfony Debug Toolbar: Use alongside the Symfony Debug Toolbar for additional context in HTTP requests.

Extension Points

  1. 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]
    
  2. Environment-Specific Dumping: Conditionally enable \dev\dd() based on environment variables:

    if (app()->environment('local')) {
        \dev\dd($variable);
    }
    
  3. Roadrunner Configuration: Adjust Roadrner’s worker settings to handle output more gracefully (e.g., increase buffer limits in rr.yaml).

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.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium