Weave 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

Phpstan Error Formatter Laravel Package

ticketswap/phpstan-error-formatter

A minimalistic PHPStan error formatter that makes each error a clickable file and line link, avoids wrapping so errors use your full terminal width, highlights variables and class names, and visually truncates long file paths.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Scope and architecture fit. This is a pure presentation-layer plugin: a single PHPStan ErrorFormatter implementation registered through extension.neon and selected via parameters.errorFormat: ticketswap. It does not analyze code, ship rules, or touch runtime. For a Laravel/PHP codebase that already runs PHPStan as a dev dependency, the architectural footprint is effectively zero — it cannot affect production behavior, request latency, or deployment artifacts. Fit is strongest where PHPStan is already a gate (levels 6–10) and the default table formatter is the friction point, not where PHPStan adoption itself is undecided.

Integration feasibility. Composer dev dependency plus either phpstan/extension-installer auto-discovery or a single includes: line, plus one config parameter and an optional editorUrl. Realistically a sub-hour task for one engineer, verified by running PHPStan once and eyeballing output. Release history shows deliberate compatibility work — PHPStan 2 support (1.1.4), Windows support (1.2.5), relative paths (1.0.3), non-decorated/CI output handling (1.1.0, 1.2.4), PHP 8.1 baseline with older-version support in earlier tags. Verify exact PHP and PHPStan constraints against composer.json rather than README badges.

Technical risk (ranked).

  1. Internal coupling to PHPStan. The formatter consumes PHPStan error/tip/identifier data and its formatter contract. A PHPStan major is the most likely break vector. Blast radius is a red CI job on a dev tool — annoying, not customer-facing — but it can block merges if the pipeline fails hard on the formatter rather than the findings.
  2. Naive regex highlighting. Highlighting of variables, FQCNs, and types is explicitly documented as best-effort. Failures are cosmetic (missed color), not correctness failures. Acceptable.
  3. Low adoption signal. 87 stars, 0 dependents, single-vendor (TicketSwap) maintainership. That is a bus-factor and long-term-support concern, not a code-quality concern. Treat it as a swappable convenience, never a platform standard you cannot remove in one commit.
  4. Output ergonomics can cut both ways. Not wrapping takes the full terminal width; visually truncated paths (src/App/../Entity/User.php) reduce log greppability, partially offset by the 1.3.0 "don't trim when an AI agent is detected" behavior. Long lines also inflate CI log volume on large error counts.
  5. Environment mismatch. Clickable-link value collapses in Docker/remote-dev setups where container paths don't resolve on the host, and in most CI log viewers. The fallback (file:///… or plain path) is functional but loses the core benefit.
  6. Inflated benefit claims. The promotional framing around docblock cleanup, "~40% time-to-fix," and "~15% parsing overhead" is not supported by this package's scope (it is a formatter; it doesn't edit docblocks or change analysis) and should be stripped from any internal business case. Justify on developer satisfaction and triage speed, measured, not asserted.

Key questions for the owner/team.

  • Which PHPStan major/minor are we pinned to, and who owns the upgrade when PHPStan bumps its formatter interface?
  • Does a formatter exception fail the build, or degrade gracefully? Is the formatter on the critical path of the merge gate or a supplementary log step?
  • What is the actual pain today — error readability, navigation, or noisy rules? A formatter only addresses the first two.
  • Do our developer environments (local terminal, IDE, remote containers) resolve editorUrl paths consistently across the team?
  • Which CI surfaces consume output — GitHub Actions annotations, GitLab, Jenkins? Those generally prefer --error-format=github/json, which this package does not replace.
  • What is the measurable success criterion and timebox (e.g., time-to-triage on a sample of 20 real PHPStan runs, before/after, plus a developer survey)?

Integration Approach

Stack fit. Any Laravel/PHP repo on PHP 8.1+ running PHPStan 1.x or 2.x, with Composer-managed dev tooling. It coexists cleanly with phpstan/extension-installer, Larastan, and existing baselines because it changes only the renderer. No production dependency, no autoload impact, no framework coupling.

Migration path (low-risk, reversible).

  1. Add ticketswap/phpstan-error-formatter as a require-dev entry with a caret constraint; commit the lockfile.
  2. Register via extension.neon include (or rely on the installer, if adopted org-wide).
  3. Set parameters.errorFormat: ticketswap in the project phpstan.neon.
  4. Configure editorUrl per dominant IDE (phpstorm://open?file=%%file%%&line=%%line%%, vscode://file/%%file%%:%%line%%) and document it — this is where most of the perceived value is actually created.
  5. Verify one clean run locally and one failing run in CI, inspecting the raw log (not the terminal) to confirm readability under ANSI stripping.

Compatibility notes.

  • Keep CI machine-readable formats intact: use --error-format=github (or JSON) for annotation-producing steps and reserve ticketswap for human-facing local runs and archived CI logs. Do not let a cosmetic renderer become a pipeline dependency.
  • Windows and relative-path support exist, but validate in your matrix if you have Windows developers or containerized CI.
  • Remote/Docker dev: map editorUrl to host-visible paths or accept the degraded file:// fallback.
  • This changes nothing about findings. Any expectation of fewer errors, cleaner docblocks, or faster analysis is a misread of the package.

Sequencing. Pilot in one high-PHPStan-adoption repo for two weeks with a named owner → collect qualitative feedback plus a small time-to-triage measurement → if positive, promote via a shared tooling package or CI template so config drift doesn't accumulate → add one line to onboarding docs → schedule a recurring check tied to PHPStan upgrades.

Operational Impact

Maintenance. Near-zero steady-state cost: one dev dependency, one config block, Renovate/Dependabot handles bumps. The real maintenance event is a PHPStan major upgrade; budget a small spike there and pin a known-good formatter version ahead of the PHPStan bump.

Support. Self-serve and self-diagnosing. The failure signature is unambiguous (garbled or plain output), and rollback is deleting one config line. No on-call implications. Support burden concentrates on two questions — "why do my links not open?" (editor/terminal config) and "why is my path cut off?" (truncation) — both answerable once in documentation.

Scaling. Negligible CPU impact; the cost that scales is output volume: unwrapped lines can be very long on large error counts, which affects CI log storage, log-parser friendliness, and readability in narrow panes. Fine at typical Laravel error counts; worth a sanity check on a monorepo or a deliberately broken branch.

Failure modes and mitigations.

  • PHPStan upgrade breaks the formatter → CI red on a dev tool. Mitigate by pinning, keeping the formatter off annotation-producing steps, and treating it as removable.
  • Regex highlighting misses a construct → cosmetic only; no action needed.
  • Path truncation + ANSI codes degrade CI logs → prefer machine formats in CI; if the formatter is used there, confirm non-decorated mode output (supported since 1.1.0/1.2.4).
  • Docker/remote dev path mismatch → document the editorUrl mapping or accept fallback.
  • Project abandonment → one-line removal; no code depends on it. This is the main reason to keep it out of any "mandatory toolchain" list until adoption and maintainer activity justify it.
  • Oversold internally → the biggest operational risk is expectation mismatch. Frame the rollout as DX polish with a measured pilot, not as a quality or velocity program.

Ramp-up. Minutes for an engineer familiar with PHPStan config; the README covers install, both installation modes, and editor URLs. The only training-worthy content is per-IDE editorUrl setup and the "this is display-only" caveat. Junior developers benefit disproportionately because scannable, per-error file/line links reduce navigation overhead and mentorship interrupts — but treat that as a hypothesis to validate in the pilot, not a forecast.

TPM recommendation. Adopt opportunistically as a low-cost developer-experience improvement behind a two-week, single-repo pilot with explicit exit criteria (triage-time delta and developer preference). Do not standardize org-wide, do not depend on it in CI gating logic, and do not attach quality, defect, or velocity metrics to it — 87 stars, zero dependents, and a single-vendor maintainer make it a convenience, not infrastructure.

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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings