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: Complete example weight: 4

Here's an end to end example that resolves a single stack frame and prints the surrounding code.

use Spatie\SourcemapsLookup\SourceMapLookup;

$map = SourceMapLookup::fromFile('bundle.js.map');

// Say we got this from a JavaScript error:
//   at bundle.js:42:17
$position = $map->lookup(42, 17);

if ($position === null) {
    echo "No original source for bundle.js:42:17\n";
    return;
}

echo "Original: {$position->sourceFileName}:{$position->sourceLine}:{$position->sourceColumn}\n";

if ($position->name !== null) {
    echo "In function: {$position->name}\n";
}

// Show the surrounding code, if the map has inlined source content.
$content = $map->sourceContent($position->sourceFileIndex);
if ($content !== null) {
    $lines = explode("\n", $content);
    $start = max(0, $position->sourceLine - 6);
    $end = min(count($lines) - 1, $position->sourceLine + 4);

    for ($i = $start; $i <= $end; $i++) {
        $marker = ($i + 1 === $position->sourceLine) ? '>' : ' ';
        echo sprintf("%s %4d | %s\n", $marker, $i + 1, $lines[$i]);
    }
}
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