zerkalica/php-code-browser
A lightweight PHP package for exploring source code, navigating files, and inspecting classes and methods in a project. It provides a simple interface for understanding package internals, browsing code structure, and quickly locating implementation details during development.
Architecture fit
zerkalica/php-code-browser is not a library you call from application code — it is the historical phpcb CLI from Mayflower's PHP_CodeBrowser, a static-site generator that ingests QA artifacts and emits syntax-highlighted HTML source pages with error/coverage overlays. That makes it a build-pipeline tool, not a Laravel runtime dependency. It has no service provider, no config contract, no facade, and no events; wiring it into a Laravel app means shelling out to a binary from a Composer script or an Artisan command. Architecturally it sits next to PHPUnit/PHPCS in the require-dev + CI layer, and should never appear in the production autoload graph.
Integration feasibility
Feasible only as an isolated dev tool. Expected inputs are XML reports (PHPUnit coverage/Clover, PHPCS checkstyle, PHPMD, CPD); expected output is a directory of static HTML. A wrapper command that runs the analysis tools, points phpcb at the report directory, and writes to storage/app/reports/code-browser is ~50 lines. The realistic blockers are version drift: the tool's PEAR-era dependencies (Console_CommandLine, Log, source-tokenizing libraries) and PHP 5/7-era syntax generally collide with PHP 8.2+, PHPUnit 10/11, and PHPCS 3.x report schemas. Composer resolution in a modern Laravel 10/11 app is likely to fail outright, which pushes you to a pinned Docker image rather than an in-repo dependency.
Technical risk High, and asymmetric — the upside is cosmetic developer ergonomics, the downside is owning unmaintained code.
zerkalica is a personal fork of mayflower/PHP_CodeBrowser; divergence from upstream is undocumented, so bug reports and patches have nowhere to land.composer audit and SCA gates; expect to add exclusions or accept noise.Key questions
Stack fit
Poor as a Composer dependency; acceptable as a containerized sidecar. Treat it as infrastructure-in-a-box: a small Dockerfile with the legacy PHP runtime plus phpcb, invoked from CI or a local Make target. Laravel's role is limited to (a) a composer script alias, and (b) optionally an Artisan command that shells out and serves the output behind auth middleware from public/reports/.
Migration path Because there is nothing to migrate from in the current stack, frame this as a build-vs-buy-vs-drop comparison rather than an integration:
| Option | Effort | Maintenance | Verdict |
|---|---|---|---|
| Adopt this fork | 2–3 days (Docker + wrapper) | You own it | Only if HTML source-browsing is a hard requirement |
| Upstream Mayflower PHP_CodeBrowser | 1–2 days, same risks | Slightly better provenance | Prefer over the fork if the fork adds nothing |
phpunit --coverage-html + GitLab/Jenkins HTML publisher |
<1 day, zero deps | Vendor-maintained | Strong default |
| SonarQube / static-analysis platform | 1–2 weeks | Vendor-maintained | Right answer at org scale |
Compatibility
Pin the tool to a specific PHP minor (7.4 or 8.0) inside its own image; do not attempt to co-resolve its dependencies with the app's composer.json. Generate reports with the same PHPUnit/PHPCS versions the tool understands, or normalize artifacts through an XSLT/JSON shim before feeding it. Verify the checkstyle and Clover schemas explicitly — this is where silent mis-parsing hides.
Sequencing
reports:code-browser Artisan command + storage-backed output path + auth-gated route.Maintenance Effectively zero upstream maintenance means full ownership transfer to us. Budget for: PHP runtime upgrades, patching report-schema drift after every PHPUnit/PHPCS bump, and periodic SCA triage of an unmaintained dependency tree. A realistic steady-state cost is 1–2 engineer-days per year plus reactive firefighting on tool upgrades — acceptable for a nice-to-have, expensive for a nice-to-have nobody uses.
Support
No vendor, no SLA, no maintainer to escalate to. Internal runbooks must be written from scratch, and institutional knowledge will concentrate in one or two engineers. Add a README in the tooling repo documenting the pinned PHP version, input artifact formats, and the exact failure signatures.
Scaling Weak. HTML generation is per-file and single-threaded; on codebases above a few thousand files expect multi-minute runs and large artifact sizes (syntax-highlighted markup is verbose — hundreds of MB for monorepos). Artifact storage and CI retention policies need tuning, and the output must be sharded or pruned by module to stay usable. This is the dimension most likely to force abandonment as the codebase grows.
Failure modes
|| true in CI → stale reports presented as current.composer.json instead of the isolated image.Ramp-up Low to learn, moderate to own. A Laravel developer can be productive with the CLI in half a day and can build the Artisan wrapper in one to two days. Understanding why it breaks — tokenizer behavior, report schemas, legacy PHP quirks — takes considerably longer and is the real cost. Restrict ownership to one named engineer, document the pin, and keep the container image as the single source of truth so the tool can be deleted cleanly if the four-week evaluation says so.
How can I help you explore Laravel packages today?