PHPackages                             spatie/sourcemaps-lookup - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. spatie/sourcemaps-lookup

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

spatie/sourcemaps-lookup
========================

Fast, memory-efficient Source Map v3 lookup for PHP

1.0.0(3mo ago)1612MITPHP ^8.3

Since Apr 22Compare

[ Source](https://github.com/spatie/sourcemaps-lookup)[ Packagist](https://packagist.org/packages/spatie/sourcemaps-lookup)[ Docs](https://github.com/spatie/sourcemaps-lookup)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/spatie-sourcemaps-lookup/feed)WikiDiscussions Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (0)

Fast and memory-efficient JavaScript source map lookup for PHP
==============================================================

[](#fast-and-memory-efficient-javascript-source-map-lookup-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a7dfa784d9ae315ef4dc789d2ad83634ada4d6d6fe02ae326ed778ed47bf88d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f736f757263656d6170732d6c6f6f6b75702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/sourcemaps-lookup)[![Tests](https://github.com/spatie/sourcemaps-lookup/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/sourcemaps-lookup/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/69c2983feb2b2a337b21231c3ec4b7428df1ea9dce3d3cbf3d2118f1fd3fa4e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f736f757263656d6170732d6c6f6f6b75702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/sourcemaps-lookup)

`spatie/sourcemaps-lookup` resolves JavaScript stack frame positions against a [Source Map v3](https://tc39.es/ecma426/) file. It returns the original source file, line, column, symbol name, and enclosing scope. The package is tuned for stack frame resolution (for example, symbolicating JavaScript errors using an uploaded source map), and is narrowly focused on the read path. It does not write, merge, or transform maps.

```
use Spatie\SourcemapsLookup\SourceMapLookup;

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

// Resolve a generated position to its original source location.
$position = $map->lookup(42, 17);
echo $position->sourceFileName;  // "src/app.tsx"
echo $position->sourceLine;      // 1-based
echo $position->sourceColumn;    // 0-based

// Resolve the enclosing source-language scope.
$scope = $map->scopeAt(42, 17);
echo $scope->name;               // "onClick"
echo $scope->parent?->name;      // "DeeplyNestedTrigger"
```

Resolving 20 stack frames against a 6 MB production source map takes around 3.8 ms and uses about 18 MiB of memory on an Apple M1 Pro. See the [benchmarks page](https://spatie.be/docs/sourcemaps-lookup/v1/benchmarks) for the full picture.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/5a92bcad1d406f9e24b7e939eb7fdae4b27070cae905f06e89e308acea120627/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f736f757263656d6170732d6c6f6f6b75702e6a70673f743d32)](https://spatie.be/github-ad-click/sourcemaps-lookup)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Documentation
-------------

[](#documentation)

You'll find the full documentation on [our website](https://spatie.be/docs/sourcemaps-lookup).

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require spatie/sourcemaps-lookup
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Alex Vanderbist](https://github.com/AlexVanderbist)
- [All Contributors](../../contributors)

Correctness test fixtures in `tests/fixtures/axy/` are copied verbatim from [`axy/sourcemap`](https://github.com/axypro/sourcemap) under its MIT licence, and used as reference data for spec conformance.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance82

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

93d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Tags

spatielookupSource mapsourcemap

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/spatie-sourcemaps-lookup/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-sourcemaps-lookup/health.svg)](https://phpackages.com/packages/spatie-sourcemaps-lookup)
```

###  Alternatives

[spatie/laravel-package-tools

Tools for creating Laravel packages

952146.1M9.9k](/packages/spatie-laravel-package-tools)[spatie/laravel-data

Create unified resources and data transfer objects

1.8k35.2M1.0k](/packages/spatie-laravel-data)[spatie/macroable

A trait to dynamically add methods to a class

72964.4M76](/packages/spatie-macroable)[spatie/schema-org

A fluent builder Schema.org types and ld+json generator

1.5k11.4M117](/packages/spatie-schema-org)[spatie/regex

A sane interface for php's built in preg\_\* functions

1.1k19.8M70](/packages/spatie-regex)[spatie/enum

PHP Enums

85032.6M77](/packages/spatie-enum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
