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

Since Dec 9Pushed 9mo 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 2w 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

44

—

FairBetter than 90% of packages

Maintenance58

Moderate activity, may be stable

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

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

[laravel/framework

The Laravel Framework.

34.9k556.2M21.5k](/packages/laravel-framework)[craftcms/cms

Craft CMS

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

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

1.3k7.8M125](/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.

28145.6M202](/packages/symfony-html-sanitizer)[jakubledl/dissect

Lexing and parsing in pure PHP

2234.7M12](/packages/jakubledl-dissect)[alleyinteractive/mantle-framework

A framework for powerful WordPress development

28353.6k2](/packages/alleyinteractive-mantle-framework)

PHPackages © 2026

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