Home: Roshan Kc

← All posts

PHP · Modern PHP 6 min read

The Future of Native PHP: Will AOT Compilers and NativePHP Change What PHP Is For?

Direct answer: Native PHP is splitting PHP's future in two. NativePHP is already making PHP a credible way to ship mobile and desktop apps. AOT compilers like elephc and TypePHP are likely to become a normal way to write fast PHP extensions and single-binary tools within a year or two, but compiling whole Laravel or Symfony apps is further off and depends on the ecosystem getting much stricter about types.

Predictions about programming languages age badly, so I'll try to make mine checkable. This is the last post in a short series. The others cover what each tool is, elephc, elephc vs TypePHP and NativePHP. Here I want to ask what all of it means for PHP as a language, and for the teams betting on it.

We've been here before: what HHVM taught PHP#

The last time PHP got a native-code moonshot, it worked, and it still lost. Facebook's HipHop compiled PHP to C++, and its successor, HHVM, gave large speedups over PHP 5 at Facebook's scale. Then PHP 7 shipped in 2015 with a rewritten engine that closed most of the gap for ordinary apps. HHVM drifted toward Hack, Meta's typed PHP dialect, and eventually dropped PHP support.

The lesson wasn't "compilers don't work". It was that compatibility with the ecosystem beats raw speed. Developers chose the runtime their frameworks, packages and hosting already supported. Anyone predicting a big future for elephc or TypePHP has to explain why this time is different.

Why 2026 is different#

Three things have changed since HHVM's peak.

  1. PHP code is typed now. Scalar types, return types, union types, enums, readonly properties, property hooks: PHP spent a decade making code predictable (I traced that here). Strictly typed code is exactly what an AOT compiler needs. In 2014 that code mostly didn't exist.
  2. The projects aren't trying to replace PHP. HHVM wanted to be the runtime. elephc and TypePHP both say plainly that frameworks stay on regular PHP and you compile selected modules. A compiled .so extension that loads into stock PHP 8.5 doesn't ask anyone to switch runtimes.
  3. The problem moved. For web throughput, long-running runtimes already won: Octane, FrankenPHP, Swoole and RoadRunner removed most per-request boot cost. Compilers don't need to rescue PHP's web performance any more. They can focus on what's left: CPU-bound work, distribution and new targets.

The NativePHP half: PHP as a client language#

This is the bigger shift, and it's further along. For most of its life PHP has been a server language. NativePHP Mobile v4 (July 2026) runs Laravel inside the app and renders Blade as real SwiftUI and Jetpack Compose views. After the core went MIT in February 2026, the licensing objection went away too.

What I expect over the next couple of years:

  • More Laravel agencies offering apps. NativePHP's economics are strongest here: the team you already have can ship a companion app.
  • A plugin ecosystem that decides the ceiling. React Native's strength is that someone has already wrapped every native SDK. NativePHP's growth depends on the same thing happening for PHP.
  • Pressure on PHP's footprint. Running PHP inside a phone app makes startup time, memory and binary size matter in ways they never did on servers. That could feed back into core PHP.

What would prove me wrong: if SuperNative stalls on complex screens and teams quietly fall back to web views everywhere, NativePHP becomes "Laravel in a wrapper" again, which is useful but niche.

The compiler half: three likely outcomes#

OutcomeLikelihood (my view)What it looks like
Extensions written in PHPHighTeams compile one hot module (pricing, parsing, geometry) into a .so instead of writing C. Both elephc and TypePHP already support this.
PHP as a single-binary tool languageMedium–highCLI tools and small services ship like Go binaries. elephc's no-runtime design suits this; TypePHP adds WASI output.
Whole frameworks compiled AOTLow, near termWould need Laravel, Symfony and major packages to drop much of their dynamic magic. A multi-year effort even if the compilers were ready.

The milestones are public, so you can check them: elephc's roadmap marks 1.0.0 as production-ready and lists a WebAssembly target next. Albert Chen's May 2026 talk on Swoole's AOT compiler put general availability at May 2027. If those dates slip by more than a year, adjust your expectations accordingly.

Signals to watch in 2027#

  1. A real production write-up, from a company with a normal codebase, compiling a PHP module with elephc or TypePHP and reporting before/after numbers. Not a benchmark script.
  2. A popular Composer package shipping a compiled extension variant with a pure-PHP fallback. That's how compiled code reaches ordinary apps.
  3. elephc 1.0 and TypePHP GA arriving roughly on schedule.
  4. Framework signals: Laravel or Symfony making core paths compiler-friendly, or the PHP project discussing AOT in an RFC.
  5. NativePHP plugin breadth: payments, maps and background location covered well enough that agencies stop needing native developers for them.

What to do today#

For a CTO or a team lead, the practical advice hasn't changed much, and that's the point:

  • Ship on proven PHP. PHP 8.5, Laravel or Symfony, and Octane or FrankenPHP where boot time is the measured problem. (This is roughly the stack I already wrote about choosing.)
  • Type your code properly. It pays off today in fewer bugs, and it's the entry ticket for any compiler tomorrow.
  • Try NativePHP if a client or your product needs an app and your team is Laravel-first.
  • Let one engineer experiment with elephc or TypePHP on one isolated hot path. Learn cheaply; don't put it on the critical path yet.

Frequently asked questions#

Will PHP become a compiled language?#

Partly. AOT compilers like elephc and TypePHP already compile a typed subset of PHP to native code, mainly for extensions and tools. Regular interpreted PHP will remain the default for frameworks for the foreseeable future.

Is native PHP just HHVM again?#

No. HHVM tried to replace the PHP runtime. elephc and TypePHP are designed to work alongside standard PHP, for example by compiling modules into extensions that stock PHP loads.

When will TypePHP be production ready?#

A May 2026 talk on Swoole's AOT compiler targeted general availability for May 2027. As of November 2026 the project describes itself as under active development.

Is NativePHP the future of PHP mobile development?#

It is the most credible path for Laravel teams as of 2026, with an MIT core and native UI via SuperNative. Its long-term reach depends on how broad its plugin ecosystem becomes.

Key takeaways#

  • HHVM proved PHP could be compiled and that ecosystem compatibility decides adoption. elephc and TypePHP avoid HHVM's mistake by not trying to replace PHP.
  • PHP's decade of type-system work makes AOT compilation far more practical in 2026 than in 2014.
  • NativePHP is the larger near-term shift: PHP becoming a realistic client-app language for Laravel teams.
  • Expect compiled PHP extensions and single-binary tools soon; whole-framework compilation is a long way off.
  • Check the public milestones (elephc 1.0, TypePHP GA targeted for May 2027) to see whether these predictions hold.

Sources#

Planning a PHP roadmap for the next few years? Let's talk.