It is time to bring opposites together, to stir up these stagnant waters, and to restore an industry that is dynamic from within, with multiple connections that were previously impossible or unimaginable.
In the previous parts of this series, we explored how allows it to target wildly different runtimes like Node.js, Erlang's BEAM, Chez Scheme, etc.
But hey, what about the elephant in the room? Yes, what is running the majority of the web, today, in the shadow. You know. The eternal one, the big boy, the veteran, the one whose death everyone talks about, but who never truly dies.
. From legacy WordPress sites to affordable shared hosting (cPanel, OVH, GoDaddy, basic LAMP stacks), a massive portion of the internet lives in environments where escaping the PHP runtime is either financially unviable, technically impossible, or simply unnecessary.
And yet...
For a long time, the PHP ecosystem has been left without a true, strictly typed functional and safe alternative, like TypeScript for Javascript. Even though recent PHP versions introduced fantastic features (short closures, match expressions, Fibers), the frustration that comes with its historical limitations and dynamic typing remains very real for some of its users.
Very well!
This is why I built
It is no longer a proof of concept. It is passing the
So... phpurs bridges this gap. It allows you to write your entire business logic, API, and background processes in 100% pure, strictly typed PureScript. And you get all the guarantees of ADTs, pattern matching, the Aff monad, HKTs... and so much more...
Then, you compile it, and you get plain .php files. No overhead. The compiler has pruned what the runtime won't need, and optimized everything (e.g. ).
, and the , when you're coding.
There is no need for complex daemonized C or Go extensions like Swoole or FrankenPHP. By relying exclusively on native PHP Fibers and asynchronous libraries (like Amphp), phpurs ensures that your concurrent PureScript code can run natively anywhere PHP runs. It
The difference in performance is entirely negligible in practice. You lose almost nothing in speed, but you gain the ability to deploy your code on any server in the world for pennies.
I recently battle-tested phpurs against the test suite of a
Community contributions are highly welcome! If you want to help add missing PHP FFIs to core and major PureScript libraries, your PRs are more than welcome.
Let's bring the elegance of PureScript to the 70% of the web that still runs on PHP! 🐘
Cheers 👋
SOCIAL SHARE CARD GENERATOR