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

Php Var Dump Check Laravel Package

jakub-onderka/php-var-dump-check

Abandoned CLI tool that scans PHP projects for leftover debug dumps (var_dump, print_r, var_export, plus Tracy/Ladybug/Symfony/Laravel/Doctrine/Zend helpers). Supports excludes, extension filtering, and optional colored output via console highlighter.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation: Add to composer.json under require-dev:

    "jakub-onderka/php-var-dump-check": "^0.3"
    

    Run composer install.

  2. First Run: Execute in your project root:

    ./vendor/bin/var-dump-check .
    

    This scans all .php files for forgotten var_dump, var_export, or print_r calls.

  3. Laravel-Specific Scan: For Laravel projects, use the --laravel flag to detect dd()/dump() calls:

    ./vendor/bin/var-dump-check --laravel --exclude vendor app/
    

Implementation Patterns

Workflow Integration

  1. CI/CD Pipeline: Add to composer.json scripts:

    "scripts": {
      "test": [
        "@phpunit",
        "@var-dump-check"
      ]
    }
    

    Run with composer test.

  2. Pre-Commit Hook: Use with tools like Husky or Git Hooks:

    ./vendor/bin/var-dump-check --laravel --exclude vendor app/
    
  3. IDE Integration:

    • PHPStorm: Add a custom inspection via File > Settings > Inspections > Custom Scopes.
    • VSCode: Use a task runner (e.g., tasks.json) to trigger the check on save.
  4. Team Onboarding: Document the check in CONTRIBUTING.md or README.md as a mandatory step for new developers.

Common Use Cases

  • Debugging Leaks: Scan after feature completion to remove accidental dd() calls:
    ./vendor/bin/var-dump-check --laravel app/Http/Controllers/
    
  • Legacy Codebases: Use --symfony, --tracy, or --doctrine flags for framework-specific debug tools:
    ./vendor/bin/var-dump-check --symfony --exclude vendor .
    
  • Focused Scans: Target specific files or directories:
    ./vendor/bin/var-dump-check --laravel app/Models/User.php
    

Gotchas and Tips

Pitfalls

  1. False Positives:

    • Static Analysis Limitation: The tool may flag intentional debug calls (e.g., in debug() methods).
    • Workaround: Exclude directories like tests/ or DebugHelper.php:
      ./vendor/bin/var-dump-check --exclude tests/ --exclude app/Helpers/DebugHelper.php app/
      
  2. Performance:

    • Large Codebases: Scanning vendor/ or monorepos may be slow. Use --extensions php to limit file types.
    • Parallel Processing: For speed, pair with jakub-onderka/php-parallel-lint (though this package is abandoned; use alternatives like php-parallel-lint/PHP-Var-Dump-Check).
  3. Framework-Specific Quirks:

    • Laravel: The --laravel flag misses dd() calls inside closures or dynamic function calls (e.g., $callback()).
    • Symfony: May miss dump() calls in Twig templates or service container configs.
  4. Abandoned Package:

Debugging Tips

  1. Verbose Output: Use --no-colors to parse logs programmatically:

    ./vendor/bin/var-dump-check --laravel --no-colors app/ | grep "dump found"
    
  2. Custom Patterns: Extend functionality by modifying the source (e.g., add support for Xdebug::dump()).

  3. Exclusion Strategies:

    • Glob Patterns: Exclude multiple paths:
      ./vendor/bin/var-dump-check --exclude {vendor,tests,storage/*} app/
      
    • File Extensions: Limit to .php files only:
      ./vendor/bin/var-dump-check --extensions php app/
      

Extension Points

  1. Custom Debug Functions: Add support for new debug tools by:

    • Forking the package and extending JakubOnderka\VarDumpCheck\VarDumpCheck.
    • Example: Add a --custom flag to accept regex patterns for function names.
  2. Integration with PHPStan/Nikic: Combine with static analyzers for deeper checks:

    ./vendor/bin/phpstan analyse app/ --level=5
    ./vendor/bin/var-dump-check --laravel app/
    
  3. Git Integration: Use with git diff to check only modified files:

    git diff --name-only HEAD~1 | xargs ./vendor/bin/var-dump-check --laravel
    
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport