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

Technical Evaluation

Architecture Fit

  • Pros:

    • Debugging & QA Tool: Fits well into a Laravel-based development workflow as a static analysis tool to detect accidental var_dump, dd, or framework-specific debugging calls left in production code.
    • Framework-Specific Support: Explicitly supports Laravel’s dd()/dump() functions, reducing false negatives in Laravel projects.
    • Lightweight: Runs as a CLI tool, requiring no runtime overhead in production.
    • Extensible: Supports multiple frameworks (Symfony, Doctrine, Tracy, etc.), making it adaptable if the stack evolves.
  • Cons:

    • Abandoned Project: No active maintenance since 2018 raises concerns about compatibility with modern PHP/Laravel versions (e.g., PHP 8.x, Laravel 9+).
    • Limited Scope: Only detects debugging dumps, not other anti-patterns (e.g., SQL queries, deprecated APIs).
    • No IDE Integration: Requires manual CLI execution, unlike modern tools (e.g., PHPStan, Psalm) with IDE plugins.

Integration Feasibility

  • Laravel Compatibility:
    • Works with Laravel’s dd()/dump() (tested in v0.3), but untested against newer Laravel versions (e.g., 10.x).
    • May conflict with custom dd() aliases or monolithic debugging functions.
  • CI/CD Fit:
    • Can be integrated into pre-commit hooks (e.g., via Git hooks or Husky) or CI pipelines (e.g., GitHub Actions) to block debugging calls in main/production branches.
    • Example CI snippet:
      - name: Check for forgotten debug dumps
        run: vendor/bin/var-dump-check --laravel --exclude vendor .
      
  • Dependency Risks:
    • Relies on jakub-onderka/php-parallel-lint (also abandoned), which could introduce instability.
    • No PHP 8.x support may cause syntax errors or runtime issues.

Technical Risk

  • High:
    • Compatibility: Untested with PHP 8.x features (e.g., union types, named arguments) or Laravel 9+ changes (e.g., dd() in Illuminate\Support\Facades).
    • False Positives/Negatives:
      • May flag intentional debug calls in feature flags or staging-specific branches.
      • Might miss debug calls in dynamically generated code (e.g., Blade templates with @dump).
    • Maintenance Burden: Requires manual updates if the tool breaks (e.g., due to PHP deprecations).
  • Mitigation:
    • Fork and Modernize: Fork the repo to add PHP 8.x support and Laravel 10+ compatibility.
    • Complementary Tools: Use alongside phpstan/extension-installer or roave/security-advisories for broader checks.
    • Exclusion Rules: Configure --exclude to ignore test/staging directories.

Key Questions

  1. PHP/Laravel Version Support:
    • Does the tool work with PHP 8.2+ and Laravel 10.x? If not, what’s the effort to modernize it?
  2. False Positive Handling:
    • How will the team handle legitimate debug calls (e.g., in staging branches)?
  3. CI/CD Integration:
    • Should this block merges to main (strict) or just log warnings (lenient)?
  4. Alternatives:
    • Would phpstan/phpstan (with custom rules) or psalm be a better long-term fit?
  5. Performance:
    • What’s the runtime overhead for large codebases (e.g., 10K+ files)?

Integration Approach

Stack Fit

  • Best For:
    • Laravel Monorepos: Detects dd()/dump() in PHP files, Blade templates (if configured), and service providers.
    • CI/CD Pipelines: Lightweight enough for pre-merge checks.
    • Legacy Codebases: Helps clean up debug clutter during refactoring.
  • Less Ideal For:
    • Runtime Debugging: Not a replacement for Xdebug or Laravel Telescope.
    • Dynamic Code: May miss debug calls generated at runtime (e.g., via eval() or dynamic Blade includes).

Migration Path

  1. Pilot Phase:
    • Install in a dev dependency (composer require-dev jakub-onderka/php-var-dump-check:^0.3).
    • Test on a non-critical branch with:
      ./vendor/bin/var-dump-check --laravel --exclude vendor ./app
      
    • Verify no false positives/negatives.
  2. CI Integration:
    • Add to GitHub Actions/GitLab CI as a required check for PRs targeting main:
      - name: VarDump Check
        run: composer require-dev jakub-onderka/php-var-dump-check && ./vendor/bin/var-dump-check --laravel --exclude vendor .
      
  3. Local Development:
    • Add to package.json scripts (if using Laravel Mix/Vite):
      "scripts": {
        "debug-check": "php vendor/bin/var-dump-check --laravel --exclude vendor ./app"
      }
      
    • Run via npm run debug-check or alias in .bashrc.

Compatibility

  • Laravel-Specific:
    • Supports dd()/dump() from Illuminate\Support\Facades\Debug and Symfony\Component\VarDumper\VarDumper.
    • May miss custom dd() aliases (e.g., app('debug')->dd()).
  • Blade Templates:
    • Does not natively scan Blade files (.blade.php). Workaround:
      • Compile Blade to PHP first (php artisan view:clear + scan compiled views in storage/framework/views).
      • Or use a regex-based linter for @dump directives.
  • PHP 8.x:
    • Unsupported. Requires forking to add PHP 8.x syntax parsing (e.g., match expressions, attributes).

Sequencing

  1. Phase 1: Basic CLI integration in CI (low risk).
  2. Phase 2: Local development hooks (medium risk; may require IDE setup).
  3. Phase 3: Automated blocking of PRs with debug calls (high impact; needs exclusion rules).
  4. Phase 4: Fork/modernize for PHP 8.x/Laravel 10+ (long-term).

Operational Impact

Maintenance

  • Pros:
    • Low Maintenance: CLI tool with no runtime dependencies.
    • Self-Contained: No need to update Laravel core or vendor packages.
  • Cons:
    • Abandoned Upstream: Bug fixes or PHP version support require internal effort.
    • Configuration Drift: Exclusion rules may need updates as the codebase grows.
  • Mitigation:
    • Fork the Repo: Maintain a private fork with PHP 8.x patches.
    • Document Exclusions: Keep a VAR_DUMP_CHECK_EXCLUDES.md file for team-wide rules.

Support

  • Developer Onboarding:
    • Easy: One command to run (./vendor/bin/var-dump-check).
    • Training Needed: Educate team on false positives (e.g., debug calls in feature flags).
  • Troubleshooting:
    • Common Issues:
      • False positives in test files (solve with --exclude tests).
      • Blade template misses (solve with manual compiled view checks).
    • No Support: No upstream help; rely on community forks or internal fixes.

Scaling

  • Performance:
    • Linear Scaling: Processes files sequentially (no parallelism by default).
    • Large Codebases: May slow down CI if scanning 10K+ files. Mitigate with:
      • Exclude directories (e.g., --exclude storage --exclude tests).
      • Run in parallel (if forking, add php-parallel-lint support).
  • Resource Usage:
    • Memory: Low (tokenizes files line-by-line).
    • CPU: Minimal; dominated by disk I/O.

Failure Modes

Failure Scenario Impact Mitigation
Tool breaks with PHP 8.x CI pipeline fails Fork and patch for PHP 8.x support
False positives block PRs Developer frustration Whitelist directories/feature flags
Blade templates not scanned Debug calls in views missed Scan compiled views or add regex checks
Abandoned dependency issues php-parallel-lint breaks Pin versions or replace with symfony/finder

Ramp-Up

  • Time to Value:
    • Day 1: Basic CI integration (30 mins).
    • Week 1: Local development adoption (1 hour training).
    • Month 1: Automated PR blocking (requires exclusion tuning).
  • Key Metrics:
    • **Debug
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