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(7mo ago)11.5M↓40.2%11MITPHPPHP &gt;=8.1CI passing

Since Dec 9Pushed 7mo 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 3d 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

45

—

FairBetter than 91% of packages

Maintenance63

Regular maintenance activity

Popularity43

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity49

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

225d 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

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[amphp/http-server

A non-blocking HTTP application server for PHP based on Amp.

1.3k6.7M110](/packages/amphp-http-server)[symfony/html-sanitizer

Provides an object-oriented API to sanitize untrusted HTML input for safe insertion into a document's DOM.

27941.7M141](/packages/symfony-html-sanitizer)[jakubledl/dissect

Lexing and parsing in pure PHP

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

The easiest way to build robust parsers in PHP.

412183.1k4](/packages/parsica-php-parsica)[kingsquare/php-mt940

Simple MT940 parser in PHP

107838.9k3](/packages/kingsquare-php-mt940)

PHPackages © 2026

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