wapmorgan/php-deprecation-detector
PhpDeprecationDetector scans PHP projects for deprecated functions, constants, variables, ini directives, behavior changes, and reserved identifiers that may break on newer PHP versions. Available as a PHAR or Composer tool, with console scanning and JSON reports.
phpunit listeners).vendor/ (third-party dependencies) and node_modules/ via --exclude, reducing noise.strtoupper() edge cases) may trigger false alarms. Mitigation: Use --skip-checks or post-process JSON output.--max-size).--target to align with Laravel’s PHP version.vendor/)? Exclude or allow?phpdd in a custom command (e.g., php artisan deprecation:scan).phpstan first, then phpdd).pre-commit to block deprecations early (requires local installation).--output=json to log issues without blocking builds.vendor/ initially: phpdd --exclude vendor src/.--target to future PHP versions).| Phase | Action | Tools/Commands |
|---|---|---|
| Discovery | Scan entire codebase, exclude vendor/, log JSON output. |
phpdd --exclude vendor --output=json:report.json src/ |
| Triage | Review false positives, adjust --skip-checks if needed. |
Manual review + JSON parsing |
| CI Integration | Add to CI pipeline, fail on warnings (optional). | GitHub Actions/GitLab CI |
| Local Enforcement | Integrate into pre-commit hooks. | husky + custom script |
| Future-Proofing | Target PHP 8.2+ in scans, monitor for new deprecations. | phpdd --target 8.2 src/ |
composer global require).--skip-checks) for known edge cases (e.g., strtoupper()).preg_replace with e modifier) in the team wiki.mcrypt_generic_end() → mcrypt_generic_deinit()).--max-size to skip giant files (e.g., 10mb).| Scenario | Impact | Mitigation |
|---|---|---|
| Build Breaks on Deprecations | Blocks merges. | Start with warnings, then enforce. |
| False Positives | Noisy alerts. | Tune --skip-checks or exclude files. |
| CI Timeout | Scan takes >10 mins. | Limit to changed files (git diff). |
| PHP Version Mismatch | Scanner misses deprecations. | Align --target with Laravel’s PHP. |
src/ in CI, log JSON.--skip-checks.--target with PHP upgrades.Key Metric: Reduce deprecation-related runtime errors by 80% within 3 months.
How can I help you explore Laravel packages today?