Skip to content

Introducing 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 ecosystem

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.

Some features only available to Patreon sponsors

Please note that WpDotNet distributions as NuGets, IDE extensions and other features are only accessible to our patrons. Check our Patreon page for more details.

Applications and performance

WpDotNet 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.

Only available to Patreon sponsors

Please note that WpDotNet distributions as NuGets are only accessible to our patrons. Check our Patreon page for more details.

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.

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 and tried the official Zend bench with a 27% performance improvement:

Zend bench

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.

Performance is subject to change

PHP's performance has improved drastically since this post. In some instances, we may no longer offer performance benefits over vanilla PHP.

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 the 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.

Some features only available to Patreon sponsors

Please note that distributions as NuGets, IDE extensions and other features are only accessible to our patrons. Check our Patreon page for more details.

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 make your life simple by utilizing some of the many benefits available to our patrons on Patreon.

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…