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.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony