PHPackages                             portbay/blade-stamper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. portbay/blade-stamper

ActiveLibrary[Templating &amp; Views](/categories/templating)

portbay/blade-stamper
=====================

Dev-time source-location stamping for Laravel Blade templates — data-pb-loc for PortBay's visual editor.

v0.1.0(yesterday)02↑2900%MITPHPPHP &gt;=8.1

Since Aug 14Pushed yesterdayCompare

[ Source](https://github.com/portbay-app/blade-stamper)[ Packagist](https://packagist.org/packages/portbay/blade-stamper)[ RSS](/packages/portbay-blade-stamper/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

@portbay/blade-stamper (`portbay/blade-stamper`)
================================================

[](#portbayblade-stamper-portbayblade-stamper)

Dev-time **Laravel Blade** source-location stamping for PortBay's visual editor. It stamps each rendered host element with its authored source location, `data-pb-loc="::"`, so a clicked element resolves back to the exact span in your `.blade.php` file instead of a text-search guess.

```
Get started
```

This is the Blade sibling of [`@portbay/swc-plugin-loc`](../swc-plugin-loc), and it emits the same `data-pb-loc` shape, so PortBay's resolver handles Blade with no client changes. With the attribute present you get precise text, class and attribute editing, plus structural editing. Without it, PortBay falls back to text search with no change in behaviour.

How it works (and why it needs no source-map)
---------------------------------------------

[](#how-it-works-and-why-it-needs-no-source-map)

Blade compiles server-side, so there is a point where the **raw** template text is available with its original line numbers. The stamper registers as the **first** Blade compilation pass via `Blade::prepareStringsForCompilationUsing`, which runs *before* Blade mutates the string (before comment stripping, `@php`extraction and `` rewriting). Coordinates are read from the pristine source and baked in as literal attribute strings. Nothing has to be traced back from compiled output.

A Blade-aware **masking** pass blanks every code region: `{{ }}` / `{!! !!}`echoes, `{{-- --}}` comments, `` blocks, `@php … @endphp`, `@verbatim`, and `@directive(...)` arguments, so a stray `
