PHP Language Extensions Library

A PHP library that adds compile-time-style guarantees — such as package-level visibility and must-use return values — enforced by static analysis.

DaveLiddament/php-language-extensions View on GitHub


The PHP Language Extensions library adds guarantees that PHP itself doesn't enforce — package-level namespace visibility, must-use return values, restricting traits to specific classes, and more — using attributes checked by static analysis. It lets you express and enforce design intent that would otherwise live only in comments.

Related articles

Related talks

Extending the PHP Language

Learn how to implement new language features using static analysis.

Given 9 times, most recently May 2025