PHP code example of spatie / sourcemaps-lookup
1. Go to this page and download the library: Download spatie/sourcemaps-lookup library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spatie / sourcemaps-lookup example snippets
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"