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

Laravel Blade Comments Laravel Package

spatie/laravel-blade-comments

Spatie's Laravel Blade Comments package wraps each rendered Blade view and component in HTML comments, so browser dev tools immediately reveal which view produced which markup, plus extra request info at the top of the document.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for developer tooling. This is a ~15-minute adoption (composer require --dev) versus an internal "view-to-output tracer" project. Unless you have a hard dependency policy, buying is the obvious call — MIT licensed, no runtime footprint, no vendor lock-in beyond a single config file and two small interfaces.
  • Prioritizing DX/onboarding investment. It directly attacks a measurable onboarding cost: a new engineer inspecting a rendered page can see front.pages.docs.partials.breadcrumbs in dev tools instead of grepping the repo or asking a teammate. That shortens time-to-first-meaningful-PR and reduces interrupt load on senior engineers.
  • Evidence for a frontend/Blade refactor roadmap. Because it annotates every include, component, section, and Livewire component, the rendered HTML becomes a map of your view tree. Deep nesting and repeated partials in the comments are concrete input to decisions like "extract a component library," "collapse these 40 partials," or "migrate this screen to Livewire/Inertia."
  • Scoping design-system and migration work. During a Blade → component or CSS rework, comments let you attribute visual regressions to a specific view file during review rather than bisecting by guesswork.
  • Support and incident triage hygiene. For internal admin panels and back-office tooling, the request commenters (top-of-page view + route info) reduce back-and-forth on bug reports: "the broken block is partials.sidebar" is a better ticket than a screenshot.
  • Vendor/dependency portfolio decisions. A dev-only Spatie package with a published config, changelog, releases, and a clean extension interface is a low-risk line item. Note the signal is thin (180 stars, 0 dependents), so treat it as a tool to trial, not a platform to standardize on.

When to Consider This Package

Adopt when most of these hold:

  • You are on Laravel + Blade (including Livewire-heavy apps) with a view tree deep enough that "which file renders this?" is a recurring question.
  • You have multiple engineers on the frontend, or frequent onboarding, or a large legacy Blade surface.
  • A dev-only dependency is acceptable and you can tolerate comments in local HTML.
  • You can maintain a short exclusions list — partials that inject CSS/preconnect tags and sections used inside attributes or meta tags will need to be added to excludes.includes / excludes.sections, otherwise markup can be subtly malformed.
  • Your test suite doesn't assert exact rendered HTML in many places; if it does, expect snapshot churn and gate the package behind a test-env flag.

Look elsewhere when:

  • Rendering is not Blade (Inertia/Vue/React SPA, API-only JSON, transactional email templates) — the value proposition disappears and HTML comments may actively harm email clients or non-HTML responses.
  • You need production-safe observability (per-request tracing, performance profiling, error attribution in prod). Use Telescope, a debug bar, APM/Sentry, or frontend source maps instead. This package is explicitly debug-gated ('enable' => env('APP_DEBUG')) and would leak file paths and structure if forced on in production.
  • You need zero config: the exclusions list is a small but real ongoing maintenance task on a bespoke view layer.
  • You want ecosystem validation before standardizing — 0 dependents means no public signal. Trial on one or two repos first; the extension points (BladeCommenter, RequestCommenter) keep exit costs low if you later drop it.
  • You have a strict "minimal dev dependencies" policy or a CI that treats HTML output as a contract.

How to Pitch It (Stakeholders)

For executives: A free, MIT-licensed, dev-only utility that tells engineers exactly which template produced any piece of a web page. It costs one line in composer.json, is disabled automatically in production via APP_DEBUG, adds zero runtime overhead for customers, and has no data or security exposure when configured correctly. The return is reduced debugging and onboarding time on our Laravel frontend — a cheap, reversible bet, not a platform commitment.

For engineering: Install as a dev dependency; comments are injected around every Blade view, component, include, @yield, and Livewire component, plus a header block with the top-most view and route. Config lets you exclude includes (CSS-injection partials) and sections (those used inside attributes/meta tags), and the v2 release replaced regex with Blade's AST parser, so the annotations are structurally aware rather than string-hacked. Extensible via two small interfaces if we want custom annotations. Two caveats to plan for: pin the version and expect some churn in tests that assert exact HTML, and never enable it outside APP_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.
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table