jdlabails/php-project-analyzer-bundle
A PHP project analyzer bundle for inspecting application structure, dependencies, and code health. It helps developers understand complex codebases and identify areas for refactoring or maintenance, giving quick visibility into Laravel/PHP projects before audits, upgrades, or onboarding.
Architecture fit: Poor as packaged, and the mismatch is structural rather than cosmetic. Despite framing this as a Laravel/PHP package, jdlabails/php-project-analyzer-bundle is a Symfony Bundle — it ships a Bundle class plus container service definitions intended to be registered in config/bundles.php and wired through Symfony's DI container, parameter bag, and event system. Laravel has no Bundle concept; integration requires translating the bundle's service definitions into a ServiceProvider, reimplementing configuration binding (Laravel config/*.php vs Symfony Configuration trees), and resolving any Symfony-component coupling (Console, Finder, Yaml, DependencyInjection). Depending on how much of the analysis logic lives in the bundle versus the underlying PhpProjectAnalyzer library, this could range from a half-day adapter to a partial rewrite.
Integration feasibility: Low-to-moderate. The realistic path is not installing the bundle, but targeting the underlying jdlabails/php-project-analyzer library directly and writing a thin Laravel service provider — or, more likely, invoking it as a standalone CLI in CI. Before any commitment, confirm whether the bundle contains meaningful logic or is a pure wiring shim; if the latter, the bundle is disposable and only the engine matters.
Technical risk: High, and concentrated in three places.
composer.json platform constraints (php: ^7.0, old symfony/* ranges, pinned nikic/php-parser or symfony/finder) that hard-conflict with a modern Laravel dependency graph. AST-parser pins are the most common blocker, since php-parser is also pulled in transitively by static-analysis tooling.Key questions:
php-cs-fixer)?composer.json constraints, and does the engine resolve against our current PHP and Laravel versions?Verdict: Do not adopt the bundle as a dependency. Evaluate the underlying engine as a 1–2 day spike; if it earns its place, fork it in-house rather than depend on it.
Stack fit: Assumes a Laravel application on PHP 8.x. The bundle will not autoload into that stack without modification. Two viable shapes:
ServiceProvider binding the engine, plus a config file and an artisan command. Only justified if we need on-demand analysis from the application itself — a rare requirement for a project-quality tool.Migration path: No migration — this is net-new instrumentation. The practical sequence is: confirm the engine's dependency resolution in an isolated Composer project → run it against one representative Laravel repo → diff its findings against PHPStan/PHPMD output → decide fork vs replace.
Compatibility: Expect to pin the fork to modern PHP ourselves. nikic/php-parser is the highest-probability breakage point; a 2018 analyzer will target the v3/v4 AST API, and v5 changed node structures. Budget for an upgrade pass on the fork — this is the single largest unknown in the estimate.
Sequencing:
internal/php-project-analyzer, bump PHP and parser constraints, add CI. If not: standardize on PHPStan + PHPMD + Deptrac and close the evaluation.Maintenance: The dominant cost. We inherit the entire maintenance burden the moment we fork — PHP version bumps, parser API upgrades, rule correctness, false-positive triage. Realistically 2–5 engineer-days per year of steady-state upkeep plus a spike each PHP major. There is no upstream to send patches to in any meaningful sense; assume zero responsiveness.
Support: None. No maintainer SLA, no issue triage, no documentation beyond the README. Internal ownership must be named explicitly before adoption — an unowned analysis tool in CI becomes a broken build everyone routes around.
Scaling: Compute cost is a real but manageable factor. Per-file AST parsing on a large Laravel codebase runs minutes, not seconds. Mitigate with incremental analysis (changed files only on PRs, full sweep nightly) and caching keyed on file hash. Parallelize per-directory if the engine supports it; assume it does not and plan a shard-by-path wrapper.
Failure modes:
Ramp-up: Low for consumption (a CI step and a report), moderate for ownership (must understand the AST visitor set and metric definitions to judge correctness). The real ramp-up cost is interpretation — a TPM needs agreement on which metrics drive decisions before the numbers arrive, or the report becomes shelfware. Recommend a single owner, a documented threshold policy, and a 30-day trial with an explicit keep/kill review.
How can I help you explore Laravel packages today?