PHPackages                             scssphp/source-span - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. scssphp/source-span

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

scssphp/source-span
===================

Provides a representation for source code locations and spans.

v1.1.0(5mo ago)2947.2k↓16.9%11MITPHPPHP &gt;=8.1CI passing

Since Dec 9Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/scssphp/source-span)[ Packagist](https://packagist.org/packages/scssphp/source-span)[ RSS](/packages/scssphp-source-span/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (1)

SourceSpan
==========

[](#sourcespan)

`scssphp/source-span` is a library for tracking locations in source code. It's designed to provide a standard representation for source code locations and spans so that disparate packages can easily pass them among one another, and to make it easy to generate human-friendly messages associated with a given piece of code.

The most commonly-used interface is the package's namesake, `SourceSpan\SourceSpan`. It represents a span of characters in some source file, and is often attached to an object that has been parsed to indicate where it was parsed from. It provides access to the text of the span via `SourceSpan::getText()` and can be used to produce human-friendly messages using `SourceSpan::message()`. It's most simple implementation is `SourceSpan\SimpleSourceSpan` which holds directly the span information.

When parsing code from a file, `SourceSpan\SourceFile` is useful. Not only does it provide an efficient means of computing line and column numbers, `SourceFile#span()`returns special `FileSpan`s that are able to provide more context for their error messages.

Credits
-------

[](#credits)

This library is a PHP port of the [Dart `source_span` package](https://github.com/dart-lang/source_span).

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance69

Regular maintenance activity

Popularity43

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Every ~346 days

Total

2

Last Release

178d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75c5d927b0434111db9720dd78af8c83385cf28bb9aeafd031ba8cb0c4ffc558?d=identicon)[Stof](/maintainers/Stof)

---

Top Contributors

[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (11 commits)")

---

Tags

parsing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/scssphp-source-span/health.svg)

```
[![Health](https://phpackages.com/badges/scssphp-source-span/health.svg)](https://phpackages.com/packages/scssphp-source-span)
```

###  Alternatives

[jakubledl/dissect

Lexing and parsing in pure PHP

2244.6M11](/packages/jakubledl-dissect)[parsica-php/parsica

The easiest way to build robust parsers in PHP.

412140.4k4](/packages/parsica-php-parsica)[jejik/mt940

An MT940 bank statement parser for PHP

911.2M2](/packages/jejik-mt940)[kingsquare/php-mt940

Simple MT940 parser in PHP

105806.1k2](/packages/kingsquare-php-mt940)[denissimon/formula-parser

Parsing and evaluating mathematical formulas given as strings.

81306.8k3](/packages/denissimon-formula-parser)[codelicious/php-coda-parser

PHP parser for Belgian CODA banking files

44352.9k1](/packages/codelicious-php-coda-parser)

PHPackages © 2026

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