PeachPie


PeachPie is an open-source PHP language compiler and runtime for.NET and.NET Core frameworks. It is built on top of the Microsoft Roslyn compiler platform and is based on the first-generation Phalanger project. PeachPie compiles source code written in PHP to CIL byte-code. PeachPie takes advantage of the JIT compiler component of the.NET Framework in order to handle the beginning of the compilation process. Its purpose is not to generate or optimize native code, but rather to compile PHP scripts into.NET assemblies containing CIL code and meta-data. In July 2017, the project became a member of the.NET Foundation.

Origins

PeachPie's architecture is similar to the Phalanger project, which had originally started as coursework at the Charles University in Prague, Czechia. It was implemented on Microsoft's.NET compiler platform called Roslyn, utilizing the Roslyn API. Since 2016, the Czech company iolevel has been leading the development of PeachPie.
PeachPie has several advantages over Phalanger, both as a result of the Roslyn API and the reworked architecture of the compiler. While Phalanger was only able to target the full.NET Framework, which only ran on Windows, and cross-platform capabilities were achieved by targeting Mono, PeachPie also allows for a compilation to.NET Core, thus being cross-platform by default. The benchmarks published to date point to performance improvements of PeachPie compared to its predecessor. The project contains an advanced semantic analysis, which allows the compiler to generate C#-like symbols for enhanced interoperability features. There are similarities between PeachPie and Facebook's HHVM compiler, which executes PHP on a specially designed virtual machine. However, as Facebook announced in late 2017, version 3.24 of HHVM would be the last release compatible with PHP, as the project would focus exclusively on supporting Facebook's proprietary extension of PHP called Hack. This leaves PeachPie as the only project of this kind with the aspiration to be compatible with past and future versions of PHP.
The project receives considerable support from Microsoft, having been invited to present at the virtual conference.NET Conf and featured on Microsoft's "On.NET", as well as the.NET Rocks podcast. Since July 2017, PeachPie has been a member of the.NET Foundation. In December 2018, iolevel received the European Innovation Council's Horizon2020 grant to pursue their work on PeachPie compiler.

Objectives

The project lists several main goals:
As of 2019, officially tested and supported applications include WordPress, MediaWiki, the software that runs the Wikipedia page, and CodeIgniter. In addition, a number of other PHP frameworks and programs have been confirmed to work with workarounds by members of the open source community, e.g. Laravel, WooCommerce or Magento.