Home: Roshan Kc

← All posts

PHP · Modern PHP 5 min read

elephc vs TypePHP vs NativePHP: What "Native PHP" Actually Means in 2026

Direct answer: elephc and TypePHP are compilers: they turn typed PHP into machine code to make CPU-heavy code faster. NativePHP is an app framework: it bundles the normal PHP runtime inside iOS, Android and desktop apps so Laravel developers can ship client apps. If you want an app, use NativePHP. If you want speed, look at elephc or TypePHP, and for most web apps, try Octane or FrankenPHP first.

"Native PHP" now means two unrelated things, and they get mixed up constantly. That's understandable: all three projects took off in 2026 and all three put "PHP" and "native" in the same sentence. This is the hub for a short series. It explains the split, compares the three in one table, and links to deeper posts on each.

The two meanings of "native PHP"#

Meaning 1: PHP compiled to native code. Your PHP source becomes a machine-code binary, a shared library or a PHP extension, with no interpreter loop at runtime. That's elephc and TypePHP. The goal is performance and portability.

Meaning 2: PHP running inside a native app. Your PHP stays PHP, interpreted by a real PHP engine, but that engine lives inside an iOS, Android or desktop app with native UI and device APIs. That's NativePHP. The goal is reach: one Laravel codebase on phones and desktops.

Once you see that split, the "which is better" question mostly goes away. They don't compete.

elephc vs TypePHP vs NativePHP at a glance#

elephcTypePHPNativePHP
What it isAOT compiler: PHP → assemblyAOT compiler: PHP → C++ → nativeApp framework that embeds PHP in native shells
Made byIllegal StudioSwoole teamNativePHP (Laravel ecosystem)
Runs on Zend Engine?No. Small custom runtimePartly. Links against libphp via PHPXYes. A full PHP 8.4 runtime on mobile
Main useCLI tools, compiled PHP extensions, compute-heavy modules, iOS librariesCPU-bound backend code, Swoole workers, PHP extensionsiOS, Android, macOS, Windows and Linux apps
LaravelKeep Laravel on PHP; compile isolated modulesKeep Laravel on PHP; compile typed hot pathsFull Laravel on the device: Eloquent, Blade, Livewire
UINone (C FFI lets you call libraries like SDL)NoneSwiftUI and Jetpack Compose via SuperNative, or web view
LicenceMITGPL-3.0MIT core (v3+), paid premium plugins
Maturity (Nov 2026)Experimental, v0.27.8Experimental, active developmentStable: Mobile v4, Desktop v2

Which one do you need?#

  1. "Our clients want a mobile app and we're a Laravel shop." NativePHP. Read NativePHP in 2026 for the trade-offs against Flutter and React Native.
  2. "Our web app is slow." None of them, at first. Profile. Most slow Laravel apps are slow because of queries and per-request boot. Octane with Swoole or FrankenPHP is the proven fix.
  3. "One function is CPU-bound and we've already optimised it." That's when an AOT compiler earns a look. Compile that module as an extension with elephc or TypePHP. See elephc vs TypePHP.
  4. "I want to ship a CLI tool as one binary." elephc.
  5. "We run Swoole or Hypervel in production." Watch TypePHP; it's built by the same team for that world.

Can you use them together?#

In principle, yes, and this is the most interesting idea in the whole space. elephc can cross-compile PHP into iOS ARM64 static libraries. NativePHP apps are Swift and Kotlin shells around PHP. A compiled PHP library called from a NativePHP plugin would give you native-speed PHP for one hot routine and Laravel for everything else, on a phone.

I haven't found a published, working example of that combination. Treat it as a possibility, not a recipe. The simpler pairing works today: elephc or TypePHP compile a PHP extension for your server, and NativePHP ships the client.

Common misconceptions#

  • "NativePHP compiles PHP." It doesn't. Your PHP is interpreted on the device. Only the UI is native.
  • "TypePHP or elephc will make my Laravel app 8× faster." Not today. Both compile a typed subset, and framework code is full of dynamic behaviour they can't compile. Published speedups come from CPU-bound benchmark scripts.
  • "AOT replaces the JIT." They solve related problems in different places. The JIT (PHP 8.0+) optimises hot code inside the running engine; AOT compiles before the program runs. You can run a compiled extension inside a JIT-enabled PHP.
  • "This is HHVM again." Partly. HHVM showed PHP could be compiled and also that ecosystem compatibility decides adoption. I go into that in the future of native PHP.

Frequently asked questions#

What is the difference between NativePHP and TypePHP?#

TypePHP is an ahead-of-time compiler that turns typed PHP into C++ and then native code for speed. NativePHP is an app framework that embeds the normal PHP runtime in iOS, Android and desktop apps. One makes PHP faster; the other puts PHP in apps.

Is NativePHP a compiler?#

No. NativePHP ships a real PHP interpreter inside the app. Your PHP code is interpreted on the device; with SuperNative, only the UI is rendered natively.

Which native PHP tool is production ready?#

As of November 2026, NativePHP (Mobile v4, Desktop v2) is the stable one. elephc (v0.27.8) and TypePHP are experimental compilers best used for isolated modules.

Will elephc or TypePHP speed up my Laravel app?#

Not as a whole. Both compile a typed subset of PHP, and framework code is too dynamic. Profile first, use Octane or FrankenPHP for boot and concurrency, and compile only a proven CPU-bound module.

Key takeaways#

  • "Native PHP" means two things: compiling PHP to machine code (elephc, TypePHP) and embedding PHP in native apps (NativePHP).
  • NativePHP is the stable, production choice for Laravel developers building iOS, Android and desktop apps.
  • elephc and TypePHP are experimental AOT compilers for typed, CPU-bound code. Use them for isolated modules, not whole frameworks.
  • For a slow web app, start with profiling and Octane or FrankenPHP, not a compiler.
  • The tools can coexist: compile a hot server module, ship the client with NativePHP.

Sources#

Not sure which of these fits your product? Ask me.