Almost Generics in PHP

A practical, independent guide aligned with the PHP Foundation’s compile-time generics proposal – monomorphization, constraints, and invariance, without the runtime cost.
This book is a summary of approaches to implement generics for the PHP programming language.

New • September 2025

The book will most likely appear in September 2025, and I will give updates here once I can. So if you are interested – put your email address in the formula below.

Almost Generics in PHP: A Guided Journey Through the Official Compile-Time Proposal
Book Cover


    Independent commentary; not affiliated with the PHP Foundation.

    What you’ll learn
    • Why compile-time generics fit PHP’s request model
    • Monomorphization explained clearly (no runtime overhead)
    • Constraints & invariance in practice (and what’s out of scope)
    Table of contents (short)
    • 1. The Dream of Generics in PHP
    • 2. From Wish List to Proposal
    • 3. Inside the Compile-Time Proposal
    • 4. Constraints, Variance, and Type Safety
    • 5–8. Examples, Testing, Open Questions, Future