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

Sourcemaps Lookup Laravel Package

spatie/sourcemaps-lookup

Fast, memory-efficient Source Map v3 lookup for PHP. Resolve JavaScript stack frames to original source file, line/column, symbol name, and enclosing scope. Optimized for the read path and high-volume error symbolicating from uploaded sourcemaps.

View on GitHub
Deep Wiki
Context7

title: Reading inlined source content weight: 2

If the map has a sourcesContent array, you can retrieve the original file body by index.

$position = $map->lookup(42, 17);

if ($position !== null) {
    $content = $map->sourceContent($position->sourceFileIndex);

    if ($content !== null) {
        $lines = explode("\n", $content);
        $snippet = array_slice($lines, $position->sourceLine - 6, 11); // 5 lines above and below
    }
}

sourceContent() returns null when the index is out of range or when that entry is null in the map.

Getting a window of lines

If you only need a window of lines around the position (for example, for a stack trace snippet), use sourceLines() instead. It returns an array keyed by 1-based line number and clamps out of range bounds.

$position = $map->lookup(42, 17);

$snippet = $map->sourceLines(
    fileIndex: $position->sourceFileIndex,
    fromLine: $position->sourceLine - 15,
    toLine: $position->sourceLine + 15,
);

// $snippet === [27 => '...', 28 => '...', ..., 57 => '...']

sourceLines() returns null when no inlined content is available (same rule as sourceContent()), and an empty array when the clamped range is empty.

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.
cadot.eu/make
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky