<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh" -->

---
title: How Would You Type-Check 30 Million Lines of PHP? (with...
description: A conversation with Julien Verlaguet, one of the original creators of Hack at Facebook, tracing how a static type system was bolted onto a 30-million-line PHP...
canonical: https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How Would You Type-Check 30 Million Lines of PHP? (with Julien Verlaguet) | daily.dev
og:description: A conversation with Julien Verlaguet, one of the original creators of Hack at Facebook, tracing how a static type system was bolted onto a 30-million-line PHP...
og:url: https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh
og:image: https://api.daily.dev/og/posts/eujvd03dH.png
og:image:alt: How Would You Type-Check 30 Million Lines of PHP? (with Julien Verlaguet)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How Would You Type-Check 30 Million Lines of PHP? (with Julien Verlaguet)

**[Developer Voices](https://daily.dev/sources/developervoices)** · 141 min read · 0 upvotes · 0 comments

## Summary

A conversation with Julien Verlaguet, one of the original creators of Hack at Facebook, tracing how a static type system was bolted onto a 30-million-line PHP codebase starting around 2011. He details the shift from a lightweight security-focused 'strict mode' to a full language server, the multi-process shared-memory architecture (using OCaml before native threading existed) that let type checking run incrementally across tens of millions of lines, the dependency-tracking data structures needed to make recompiles fast, and the months of debugging non-deterministic bugs by replaying Facebook's git history to validate state consistency. The discussion then moves into why mainstream languages (Haskell, OCaml, Java) lacked the immutability guarantees needed for incremental frameworks, leading Verlaguet to design Skip, a new language mixing OO and FP with explicit mutable/immutable tracking, a distinctive 'bang' operator for lens-like mutation syntax, and a preference for type classes/traits over ML-style functors.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=J31LlAUtoos>

## Questions this post answers

### Why did Facebook build a new language called Hack instead of rewriting its PHP codebase?

Rewriting tens of millions of lines of PHP was not a viable option because such a project would take too long and the engineer would be fired before delivering. Instead, Facebook added a static type system on top of existing PHP starting around 2011, initially as an opt-in 'strict mode' for security-conscious engineers before expanding it to cover the entire codebase as Hack.

_Anyone weighing a rewrite against incremental modernization can find similar engineering trade-off stories on daily.dev._

### How did Facebook's Hack type checker handle incremental rechecking across millions of lines of PHP?

It used a multi-process architecture where forked Unix processes shared an atomic, immutable hash table in shared memory, coordinating via pipes without sending data through them. A custom dependency-tracking data structure recorded which functions or classes depended on which types, using 32-bit hashes compare-and-swapped into a 64-bit key, so that changing one file only invalidated and rechecked the specific dependents rather than the whole codebase.

_Engineers designing incremental build or analysis systems can dig into architecture deep dives like this on daily.dev._

### Why didn't Julien Verlaguet build his incremental computing framework in Haskell or OCaml instead of creating Skip?

Mainstream languages lacked immutability guarantees strong enough for incremental computing, where unrelated pieces of state must stay fully independent. Haskell's monad-based state handling required either one shared monad, which improperly ties unrelated states together, or multiple monads with unwieldy APIs including monad transformers, which felt too complex and untractable for daily use, so he designed Skip with type-level tracking of mutability instead.

_Developers comparing functional purity approaches for stateful systems can explore language design trade-offs like this on daily.dev._

## Similar posts on daily.dev

- [Creator of OCaml: Functional Programming, Formal Verification, Programming Languages](https://daily.dev/posts/creator-of-ocaml-functional-programming-formal-verification-programming-languages-xiut59vvr) · The Developing Dev · 1 upvotes · 0 comments
- [A Couple Million Lines of Haskell: Production Engineering at Mercury](https://daily.dev/posts/a-couple-million-lines-of-haskell-production-engineering-at-mercury-apjrivjvs) · Hacker News · 1 upvotes · 0 comments
- [stitcher.io](https://daily.dev/posts/stitcher-io-ydudcmogn) · stitcher.io · 7 upvotes · 2 comments
- [Where tests end and types begin](https://daily.dev/posts/where-tests-end-and-types-begin-ikbbiavql) · PHPUnit Expert · 1 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#php](https://daily.dev/tags/php), [#type-systems](https://daily.dev/tags/type-systems), [#ocaml](https://daily.dev/tags/ocaml)

[View this post on daily.dev](https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How Would You Type-Check 30 Million Lines of PHP? (with Julien Verlaguet)","url":"https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh"},"datePublished":"2026-09-25T14:16:18.271Z","dateModified":"2026-09-25T14:16:44.920Z","description":"A conversation with Julien Verlaguet, one of the original creators of Hack at Facebook, tracing how a static type system was bolted onto a 30-million-line PHP...","image":"https://i.ytimg.com/vi/J31LlAUtoos/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/J31LlAUtoos/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Developer Voices","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Developer Voices","logo":"https://media.daily.dev/image/upload/s--hV3ll_zG--/f_auto/v1724391208/logos/developervoices","url":"https://daily.dev/sources/developervoices"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,php,type-systems,ocaml","timeRequired":"PT141M","video":{"@type":"VideoObject","name":"How Would You Type-Check 30 Million Lines of PHP? (with Julien Verlaguet)","description":"A conversation with Julien Verlaguet, one of the original creators of Hack at Facebook, tracing how a static type system was bolted onto a 30-million-line PHP...","thumbnailUrl":"https://i.ytimg.com/vi/J31LlAUtoos/sddefault.jpg","uploadDate":"2026-09-25T14:16:18.271Z","duration":"PT141M","url":"https://api.daily.dev/r/eujvd03dH","embedUrl":"https://www.youtube.com/embed/J31LlAUtoos"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Developer Voices","item":"https://daily.dev/sources/developervoices"},{"@type":"ListItem","position":3,"name":"How Would You Type-Check 30 Million Lines of PHP? (with Julien Verlaguet)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-would-you-type-check-30-million-lines-of-php-with-julien-verlaguet--eujvd03dh#faq","mainEntity":[{"@type":"Question","name":"Why did Facebook build a new language called Hack instead of rewriting its PHP codebase?","acceptedAnswer":{"@type":"Answer","text":"Rewriting tens of millions of lines of PHP was not a viable option because such a project would take too long and the engineer would be fired before delivering. Instead, Facebook added a static type system on top of existing PHP starting around 2011, initially as an opt-in 'strict mode' for security-conscious engineers before expanding it to cover the entire codebase as Hack. Anyone weighing a rewrite against incremental modernization can find similar engineering trade-off stories on daily.dev."}},{"@type":"Question","name":"How did Facebook's Hack type checker handle incremental rechecking across millions of lines of PHP?","acceptedAnswer":{"@type":"Answer","text":"It used a multi-process architecture where forked Unix processes shared an atomic, immutable hash table in shared memory, coordinating via pipes without sending data through them. A custom dependency-tracking data structure recorded which functions or classes depended on which types, using 32-bit hashes compare-and-swapped into a 64-bit key, so that changing one file only invalidated and rechecked the specific dependents rather than the whole codebase. Engineers designing incremental build or analysis systems can dig into architecture deep dives like this on daily.dev."}},{"@type":"Question","name":"Why didn't Julien Verlaguet build his incremental computing framework in Haskell or OCaml instead of creating Skip?","acceptedAnswer":{"@type":"Answer","text":"Mainstream languages lacked immutability guarantees strong enough for incremental computing, where unrelated pieces of state must stay fully independent. Haskell's monad-based state handling required either one shared monad, which improperly ties unrelated states together, or multiple monads with unwieldy APIs including monad transformers, which felt too complex and untractable for daily use, so he designed Skip with type-level tracking of mutability instead. Developers comparing functional purity approaches for stateful systems can explore language design trade-offs like this on daily.dev."}}]}
```

