React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

Peachpie online REPL transpiles PHP to C# on the fly

Peachpie is a project that allows developers to run PHP in a .NET environment. The system works so that it transpiles PHP code to C#. This yields benefits in both performance and interoperability with C# libraries.

The project has been ongoing for some years, but has gained significant moment in the latter half of 2017 the project seems to have accelerated. The project accounced compatibility with real life applications like WordPress during the year, with benchmarks available in early 2018.

The current version of Peachpie is 0.9 and the latest version brought new advanced PHP 7.2 compatibility and new language features like Traits and Generators to the runtime. In addition the code can now run in the .NET Core environment deployable to Linux machines using Docker.

Setting up the tooling to run PHP in such an environment takes some time and effort. For instant gratification there is now an online REPL available for users to see how Peachpie ticks. You can try it below, or head right to the source at:

This is an interesting effort in the world of PHP. The language may be scorned upon, but it runs a large chunk of the web and is not going away any time soon. PHP 7 made big strides in performance, and PHP 8 comes with JIT. JIT in PHP has yet to yield real world benefits, though.

The Peachpie runtime might take this into another ballpark completely, allowing PHP to be on the shoulders of .NET and C# giants, running real world PHP apps with a transpilation process.

Transpilation is nowadays a common method in the JavaScript community. TypeScript, for example always transforms code from from one human readable readable format to another. Peachpie does the same, but between PHP and C# (and Visual Basic, if you must).

Software ecosystems of all kind are merging. The union between PHP and C# doesn't seem unholy, keeping in mind that the OpenJDK team is looking to integrate V8 JavaScript to their JVM implementation.

Written by Jorgé on Thursday February 1, 2018

Permalink - Tags: php, jit, dotnet

« Urql promises to simplify using GraphQL in React - Project Detroit seeks to bring the V8 JavaScript engine to OpenJDK »