Introducing PeachPie 1.0.0

PeachPie 1.0.0

PeachPie has been in development for a few years already. It is an ambitious project, so we set a few milestones before we felt comfortable releasing the official version 1.0.0.

What is PeachPie?

PeachPie is a development platform that allows developers to treat the PHP language as a native .NET language. It consists of a whole compiler, runtime, extension libraries, IDE support, MSBuild support, all fully respecting the .NET standard.

PeachPie integrates the PHP language into the .NET ecosystem, making it fully compatible with other .NET projects (like C#), fully managed, cross-platform, not requiring any native PHP, taking advantage of the whole .NET platform.

The goals of v1.0.0

We’ve focused on a few open-source PHP projects, as well as our clients’ applications for version 1.0.0 and we essentially intended to get them running on .NET fluently. In addition, there were a few features that were necessary to implement so that the project would be practically usable.

  • PHP projects can be opened, built, debugged, and profiled in Visual Studio.
  • The latest WordPress version running on .NET, without any source files. This includes WordPress, the majority of plugins, e.g. Woocommerce and Elementor, and themes.
  • Selected composer packages compile and can be used as a class library by a C# project (Twig, PHPUnit, RandomLib, dependencies of the Laravel framework).
  • Code Analysis (compilation) provides detailed and useful diagnostics about the PHP code.

Applications and Performance

WpDotNet (on is our code name for WordPress on .NET. The unmodified source code of WordPress got a project file specifying how to compile and pack it into NuGet. We have been able to demonstrate that some computations, application-wide constants, and script inclusions can be resolved once in compile time. Also, the application can benefit from the extremely fast ASP.NET Core in-memory response caching and more security options out of the box.

This results in an application running natively on ASP.NET and ASP.NET Core source-lessly, with the ability to be debugged from Visual Studio, to be integrated with C#, while performing equally or better than regular PHP. In the future, we’ll be focusing on improving the performance.

Check out, which is our catalog of projects transformed to .NET. In the future, this will allow anyone to contribute with an option to provide paid solutions.

The performance itself depends on how the application is written. Obviously, the compiler likes strongly typed declarations. Specifying type hints within the PHP code is still backward compatible with regular PHP and also it adds the benefit of a safer and faster runtime.

Did you know you can significantly improve the performance of the PHP app on .NET by taking advantage of the NativeAOT compiler? Our user Steve pointed this out on our chat and tried the official Zend bench with a 27% performance improvement:

We continuously measure a few microbenchmarks (on, and we’ll be adding more once we start with the follow-up versions 1.1 and 1.2.

What you can do with it

We have chosen a few real-life scenarios and a few fun ones.

Integration: You already have a .NET application and a PHP application. You need them to work together or you want to maintain just one platform/solution. With PeachPie, the PHP project (a website, front end, a console application, …) is treated as yet another C# project. MSBuild, compilation, deployment, code analysis, and dependencies between your projects simply work. Oh and there is no PHP.

Migration: a common scenario is that a company’s legacy code is written in PHP, and it is being maintained because it has all the magic functionalities that need to be upheld. PeachPie makes it a .NET library, and all the functions and classes become standard .NET objects. The library is then referenced by the modern code and used as it is, seamlessly. Eventually, the PHP code can be gradually replaced by C# implementations without the need of rewriting everything at once from scratch.

Performance: The code is compiled into MSIL byte-code and then compiled by the .NET JIT for your actual hardware. Well-written code can be highly optimized. If possible, the compiler generates type-safe non-dynamic code, that performs similarly to the C# code.

Running PHP cross-platform: Since PHP is .NET now, you can run it on Android and iOS, as well as on IoT devices. Moreover, it runs right in the browser as a web assembly.

.NET project in Visual Studio in PHP language.

Tooling: With PeachPie, the PHP code is receiving all the .NET stuff “for free” – neat diagnostic tools, debugging features, performance counters and monitoring, Just-in-Time compilation, Ahead-of-Time compilation, source-less distribution, GUI (Winforms, WPF, Xamarin Forms), MSBuild, packages from NuGet feeds, and more.

How to start with PeachPie

Check out our Get Started page. You can either create your own project from PHP sources running on .NET or start with compiled applications at provided as NuGet packages, such as WordPress.

Ready to start compiling PHP right now now? On the command line, assuming you installed the .NET 5 SDK, type the following:

dotnet new -i Peachpie.Templates::*
dotnet new console -lang PHP
dotnet run

The commands above download the project template, create a console project, compiles and runs it. If you want, you can then open the created project in Visual Studio 2017/2019 or in Rider.

What’s next?

Now we are ready for your feedback on version 1.0.0. We’ll likely be releasing a few subsequent versions marked as 1.0.x with fixes and updates to extension libraries.

The follow-up version 1.1 will introduce more interoperability features including C#’s dynamic understanding PHP’ types, improved support for .NET value types, and an option to dynamically compile the project at runtime, which is currently intentionally not implemented.

If any breaking changes will be needed, we’ll release 1.2. In this update, we are going to target the overall performance of compiled applications and the compiler itself.

Then we are going to evaluate all the principles and APIs, and clean up some internals, resulting in the next major release of PeachPie. No time frame yet for that.

Let us know your thoughts – what do you want PeachPie to support, feature suggestions, improvements…

Posted on March 14, 2021, in category Announcement, Information, News, tags: , , , ,