Weave Code
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 Blade Comments Laravel Package

spatie/laravel-blade-comments

Adds HTML debug comments around every rendered Blade view/component so you can see exactly which template produced each piece of output in browser dev tools. Also includes top-level request and view info at the top of the document.

View on GitHub
Deep Wiki
Context7

Add debug comments to your rendered output

Frequently asked questions about Laravel Blade Comments
How do I install spatie/laravel-blade-comments for Laravel Blade debugging?
Run `composer require spatie/laravel-blade-comments --dev` to install it as a development dependency. The package auto-registers middleware and precompiler, so no additional steps are needed unless you want to customize exclusions or add commenters. Publish the config with `php artisan vendor:publish --tag=blade-comments-config` if required.
Will this package slow down my Laravel application in production?
No, the package is disabled by default when `APP_DEBUG=false`. It only injects debug comments during development, and even then, the performance impact is negligible. Precompilation adds minimal overhead, but it’s designed to be lightweight.
Does spatie/laravel-blade-comments support Livewire components?
Yes, the package explicitly supports Livewire components (v3/v4) with dedicated commenters. If you’re using an older version of Livewire, you may need to manually adjust the regex patterns or disable the LivewireComponentCommenter via config.
Can I exclude certain Blade views from showing debug comments?
Absolutely. The package includes a config file where you can define exclusions, such as CSS/JS partials or other views you don’t need to debug. Use the `excludedViews` array in the config to blacklist specific paths or patterns.
What Laravel versions does spatie/laravel-blade-comments support?
The package is actively maintained for Laravel 11–13 and has backward compatibility for Laravel 9–10. It leverages Laravel’s Blade AST parser (since v2.0), ensuring reliability across modern versions. Check the [GitHub repo](https://github.com/spatie/laravel-blade-comments) for version-specific notes.
How do debug comments appear in the browser? Can I customize them?
Debug comments wrap each rendered Blade view/component with HTML comments like `<!-- Blade: front.pages.docs.partials.breadcrumbs -->`. At the top of the document, you’ll also see request and view metadata. You can extend or customize comments by implementing the `BladeCommenter` or `RequestCommenter` interfaces.
Are there alternatives to spatie/laravel-blade-comments for Blade debugging?
Yes, alternatives include Laravel Debugbar (for broader debugging) or IDE plugins like PHPStorm’s Blade support. However, this package is specialized for visual Blade debugging in DevTools, offering real-time HTML-level traceability without cluttering your IDE.
Will debug comments accidentally leak into production if APP_DEBUG is misconfigured?
No, the package respects Laravel’s `APP_DEBUG` setting. Debug comments are only injected when `APP_DEBUG=true`. To prevent accidental leaks, ensure your CI/CD pipeline enforces `APP_DEBUG=false` in staging and production environments.
Does this package work with custom Blade directives or macros?
The package primarily targets standard Blade directives (`@include`, `@section`, `@component`) and Livewire components. Custom Blade macros or directives may not be automatically wrapped. For full coverage, you might need to extend the `BladeCommenter` or adjust the AST parsing logic.
How can I test spatie/laravel-blade-comments in my Laravel project?
Enable debug mode (`APP_DEBUG=true`) and inspect the rendered HTML in your browser’s DevTools. Verify that comments appear around Blade views and components. Test edge cases like nested includes or excluded views to ensure the package behaves as expected in your workflow.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai