Hello everyone! ![]()
I’d like to share an experimental project I’ve been working on recently: phpurs, a brand new backend that transpiles PureScript directly to modern PHP syntax (thanks CoreFn).
Why PHP? While the broader JS ecosystem has heavily leaned towards TypeScript, the PHP world (which still powers roughly 70% of the web) has somewhat been left without a true, strictly-typed functional alternative. Furthermore, a massive portion of the web relies on legacy shared hosting or containerless VPS environments where escaping the PHP runtime is either impossible, financially unviable, or technically difficult. Just a few examples: cPanel/Plesk, GoDaddy, Bluehost, SiteGround, standard HostGator/OVH shared plans, basic LAMP stacks…
Recently, we’ve observed a genuine surge of interest for strict typing and functional concepts within the PHP community (with recent PHP versions and RFCs: short closures, match expressions, pipe operators and partial application), although the frustration that comes with its current limitations is just as real. So… phpurs aims to provide a “comfort tool” for any PHP developer looking to finally take the leap towards a much safer paradigm. It opens a door for those who want the elegance of a purely functional language like PureScript, completely bypassing the JS/TS ecosystem, while keeping deployment as simple as an FTP upload of .php files. A massive win for legacy or small projects, which constitute the majority of the web today.
For the PureScript ecosystem, I think this is a strategic opportunity to gain visibility and traction by tapping directly into the largest demographic of web developers in the world.
To prove the viability of the concept, I built a universal multi-runtime pedagogical benchmark (altbak.pub), which runs identical PureScript code across Node.js, Arista ES, Chez Scheme, Erlang BEAM… and now natively on PHP. You can find the benchmark here.
This project is still in its infancy. It is very much a proof-of-concept, the codebase is currently quite messy, highly experimental, and heavily AI-copiloted.
If anyone is interested in parsing CoreFn, optimizing PHP code generation (e.g., proper tail call optimizations for mutual recursion, inlining), or just exploring how to bridge pure FP with the PHP runtime, your help would be obviously welcome!
You can find the project here.
Love ![]()
(Edit)
Since I posted this first message, here are the main milestones achieved (in the following messages):
- The initial benchmark gave 1m30s. After dozens of compiler optimizations, the tests are now successful after ~450ms. Getting better and better!
- The project was featured on PHP Weekly, reflecting the community’s potential warm reception of it
- 100% of the official tests are green: The compiler has officially graduated from its experimental phase and is now production-ready. More details here
- Full and native support for
Aff: Asynchronous operations are handled seamlessly via PHP 8.1+ Fibers and the Revolt event loop, without blocking the OS thread. More details here - Successful validation on a real-world project: The compiler has been battle-tested against a complex, full-scale project with numerous dependencies (Postgres, S3, RabbitMQ, HTTP), with total execution times almost matching Node.js. More details here
-
Massive compilation speedups & incremental builds: By plugging into
purescript-backend-optimizer. More details here, here, and here - Production-ready ecosystem: Dedicated FFI libraries, a starter template, full Nix determinism (thanks @harryprayiv!), etc.
WIP:
- None,
phpursis paused. I’ll come back to it after the official release ofgopurs, which is imminent.
TODO:
-
Module validation: Validate tests module by module (
gopurs-*) - General code cleanup (it’s still quite messy)
- … (probably more to come)



