I'm happy to share that we have released our latest package, https://github.com/spatie/laravel-blade-comments. This package can add comments to your rendered HTML output.
At the top of the HTML document, we'll also add some extra information about the topmost Blade view and the request.
namespace Spatie\BladeComments\Commenters\BladeCommenters; class AnonymousBladeComponentCommenter implements BladeCommenter { public function pattern(): string { return '/(##BEGIN-COMPONENT-CLASS##@component\(\'Illuminate\\\\View\\\\AnonymousComponent\',\s*\'([^\']+)\'[^\)]*\)[\s\S]*?@endComponentClass##END-COMPONENT-CLASS##)/'; } public function replacement(): string { return '
If the comment function returns a string, it will be injected at the top of the HTML document.