PeachPie
   HOME

TheInfoList



OR:

PeachPie is an open-source PHP language compiler and runtime for the .NET Framework and
.NET The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
. It is built on top of the
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
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 In computer programming, machine code is computer program, computer code consisting of machine language instruction set architecture, instructions, which are used to control a computer's central processing unit (CPU). For conventional binary ...
, 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 Charles University (CUNI; , UK; ; ), or historically as the University of Prague (), is the largest university in the Czech Republic. It is one of the List of oldest universities in continuous operation, oldest universities in the world in conti ...
in
Prague Prague ( ; ) is the capital and List of cities and towns in the Czech Republic, largest city of the Czech Republic and the historical capital of Bohemia. Prague, located on the Vltava River, has a population of about 1.4 million, while its P ...
, Czechia. It was implemented on Microsoft's .NET compiler platform called Roslyn, utilizing the Roslyn
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
. 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 Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, and cross-platform capabilities were achieved by targeting Mono, PeachPie also allows for a compilation to
.NET The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
, thus being
cross-platform Within computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several Computing platform, computing platforms. Some ...
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 Facebook is a social media and social networking service owned by the American technology conglomerate Meta Platforms, Meta. Created in 2004 by Mark Zuckerberg with four other Harvard College students and roommates, Eduardo Saverin, Andre ...
's
HHVM HipHop Virtual Machine (HHVM) is an Open-source software, open-source virtual machine based on Just-in-time compilation, just-in-time (JIT) compilation that serves as an execution engine for the Hack (programming language), Hack programming lang ...
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 Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
, 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: * Performance: since the PHP code is compiled to CIL and subsequently executed, rather than interpreted, theoretically this should lead to performance improvements. The micro-benchmarks performed by the authors suggest an increased performance over standard PHP in isolated cases and tests have shown that the project is able to run PHP code about twice as fast on Azure. Using the TechEmpower plaintext benchmark, it was measured that WordPress running on PeachPie was able to serve 305,612 requests per second, whereas standard PHP served 45,616 requests per second. PeachPie is also part of the regularly published TechEmpower benchmarking rounds, where, as of 2019, PeachPie is faster than any other PHP framework appearing in the benchmark. Phalanger had also offered considerable performance benefits over a 32-bit Windows version of PHP 5.4. * Interoperability: the project allows users to interoperate between the PHP and .NET languages. As a result, unusual operations, such as injecting C# lambdas into a PHP Context or inheriting PHP classes in C#, are possible. Therefore, users can utilize PHP
libraries A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
in their .NET projects and vice versa. * Additional security: given that PeachPie compiles all the source code into one DLL file, the applications can be distributed without the original source code. The PeachPie project enables entire PHP applications and frameworks to be compiled to the standard .NET DLL format and distributed, for example, as NuGet packages. * Cross-platform capability: since PeachPie can target
.NET The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
, which is compatible with the regular .NET Framework, Xamarin and Mono, and runs on
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
,
MacOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
and
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
, it allows for PHP applications to be developed for all devices and operating systems capable of running .NET.


Supported applications

As of 2019, officially tested and supported applications include
WordPress WordPress (WP, or WordPress.org) is a web content management system. It was originally created as a tool to publish blogs but has evolved to support publishing other web content, including more traditional websites, electronic mailing list, ma ...
,
MediaWiki MediaWiki is free and open-source wiki software originally developed by Magnus Manske for use on Wikipedia on January 25, 2002, and further improved by Lee Daniel Crocker,mailarchive:wikipedia-l/2001-August/000382.html, Magnus Manske's announc ...
, the software that powers
Wikipedia Wikipedia is a free content, free Online content, online encyclopedia that is written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and the wiki software MediaWiki. Founded by Jimmy Wales and La ...
, 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.


See also

* Phalanger *
HHVM HipHop Virtual Machine (HHVM) is an Open-source software, open-source virtual machine based on Just-in-time compilation, just-in-time (JIT) compilation that serves as an execution engine for the Hack (programming language), Hack programming lang ...
* Project Zero * GraalVM


References

{{.NET Framework Free and open source compilers .NET programming languages PHP WordPress