I have been a PHP developer for decades. I love the expressiveness of the language, its "get things done" philosophy, and its ubiquity. But for a long time, I’ve shared a frustration with many of you: PHP has been trapped.
While other languages like Rust, Go, and JavaScript expanded into systems programming, mobile apps, and edge computing, PHP remained locked in the server-side request/response cycle. If I wanted to build a high-performance CLI tool, I had to switch to Go. If I wanted to run logic on an iPhone, I had to learn Swift. If I wanted to build an AI agent, I was forced into Python.
I refused to accept that limitation.
Over the last year, I have been quietly building the primitives to break PHP out of its silo. I built php2ir to compile PHP to native machine code. I built php-ios to run PHP natively on an iPhone. I built microphp to push PHP onto ESP32 microcontrollers.
But separate tools are not enough. To truly compete with ecosystems like Rust or Flutter, we need a unified workflow.
Today, I am unveiling the capstone of this vision: php-universe and the px CLI. This is my attempt to give PHP its "Cargo moment"—a single toolchain to write once and compile everywhere.
The Philosophy: PHP as a Systems Language
When I designed php-universe, I wanted to change the question from "How do I configure PHP-FPM?" to "Where do I want to deploy?"
The heart of this new system is px (PHP Extended). It’s a meta-compiler that orchestrates the specialized engines I’ve developed. Instead of a composer.json file defining libraries, you use a universe.toml file to define targets.
Here is why I built it this way.
1. True Native Compilation (No C Required)
Most attempts to compile PHP have just been transpilers to C. I wanted something better. With php2ir, I built a pipeline that goes directly from PHP 8.x source code to LLVM IR.
This means we aren't just wrapping the interpreter; we are applying LLVM's massive suite of optimizations (LTO, PGO) to PHP code. When you run px build --target=native, you get a standalone binary that rivals Go in portability and speed.
2. Mobile Logic Without the Web View
One of my most requested projects is php-ios. I built this because I believe in "Local-First" software. We shouldn't need a server to run complex business logic.
php-ios embeds a static PHP runtime directly into your iOS app. It is fully App Store compliant because it doesn't download executable code; it bundles your scripts as resources. With px, this becomes seamless: you write your logic in PHP, and px bundles it into a static library ready for Xcode.
3. The "Killer App": Edge AI Agents
This is where I am most excited. The world is moving toward autonomous AI agents, and I was tired of Python having all the fun.
I built php-embeddings to handle vector databases purely in PHP, using SIMD-style operations for speed. I built php-querylang so these agents could query their own memory using SQL-like syntax on native arrays.
When you combine this with php2wasm (my WebAssembly target), you get something incredible: A PHP AI agent that runs in the browser or on a Cloudflare Worker, searching its own vector memory, with zero latency.
No Python. No servers. Just compiled PHP.
The Architecture of px
I designed the px CLI to be the glue that holds this ecosystem together.
-
The Orchestrator: It reads your
universe.tomland decides which engine to invoke. -
The dependency shaker: For native builds, we don't want a massive
vendor/folder.pxanalyzes your code and shakes out unused classes to keep binaries small. -
The Safety Net: With
php-supply-chain-guard, I integrated security auditing directly into the build process, scanning binary extensions for backdoors before they are linked.
Why This Matters
I am not trying to replace PHP’s role in the web. I am trying to expand its territory.
Imagine writing a CLI tool for your company in the language your team already knows, but distributing it as a single binary. Imagine building an IoT device using microphp on a $2 microcontroller, using the same syntax you use for your Laravel backend.
This is the "Universal PHP" vision.
Join Me
I have built the primitives: the compilers, the runtimes, the vector stores, and the build system. But an ecosystem is built by a community.
I invite you to try out php-universe. Break things. Build weird things. Let's prove that PHP is not just a scripting language for the web—it is a systems language for the future.
You can find all the individual projects on my GitHub. Let's build something amazing.
Top comments (1)
I applaud your vision, and you are not alone in wanting to expand PHP beyond websites. FrankenPHP allows you to create binaries. NativePHP lets you build desktop and mobile apps.
For me it feels like you are forcing a language that does one thing good to do other things averagely.
I think script languages should not pretend to be system languages. Python and JavaScript are the main overachievers.