Skip to content

PeachPie 1.1.10

Happy to introduce the latest release of PeachPie - the compiler for PHP to .NET - version 1.1.10. This release includes significant improvements to our compatibility with WordPress, performance enhancements, and some additional C# interoperability features.

Besides the new features, PeachPie 1.1.10 also improves the performance and compatibility with native PHP. The runtime is better optimized to work with string values by avoiding repetitious allocations. This may not seem like a big deal, but garbage collection is a huge benefit we reap from the .NET world. By avoiding unnecessary allocations, we were able to improve our performance by a few percentage points.

As continuously test PeachPie on a full-blown WordPress instance, we always find a few incompatibilities. This release fixes the way we had originally implemented several functions, such as filter_var_array, fputcsv, or stream_context_create, to make them behave more like they do in native PHP.

WordPress 6.5.4

As mentioned above, one of the flagship apps to run on .NET using PeachPie is WordPress. This is a standalone project called WpDotNet - give it a try if you like the idea of combining the world's most popular CMS with the .NET ecosystem.

The latest PeachPie 1.1.10 allows to run WordPress 6.5.4 on .NET as a native .NET application on ASP.NET Core. Without php on the machine, everything gets compiled as a .NET assembly running cross-platform on virtually any device.

WpDotNet adds a little dashboard panel so you know you're running on .NET:

WpDotNet - At a Glance

Quick Start with WpDotNet

WpDotNet is an ASP.NET Core middleware provided as a NuGet package, it integrates into your new or existing ASP.NET Core program.

To use the latest WpDotNet version 6.5.4-rc-020

  1. Create or open an existing ASP.NET Core project, targetting at least .NET 6.0.
  2. Add a dependency to the NuGet package Peachpied.WordPress.AspNetCore, version 6.5.4-rc-020
  3. Call UseWordPress() in your configure pipeline:
    public class Startup {
        public void Configure(IApplicationBuilder app) {
            // ...
            app.UseWordPress();
            // ...
        }
    }
    

CLR Events

The update introduces an ability to add and remove a PHP callable to a CLR event. More details can be found on doc.peachpie.io.

Using CLR event

The following code depicts a sample C# class and a sample PHP program adding and removing an anonymous function (or any PHP callable) to it.

// in C# project:
class SampleContainer
{
    public event EventHandler MyEvent;    
}
<?php
// in PHP project:
$obj = new SampleContainer;
// add callable to the event handler:
$hook = $obj->MyEvent->add(
    function ($sender, $arg) {
        echo "hello!";
    }
);

// remove callable from the event handler
$hook->close();

Patreon Members

Big shoutout to our Patreon members for their support. Mainly for their great suggestions and for helping with tracking down the bugs and various issues. MUch love to: - Mark Schroeder - Zagrag - Richard Aubin - Kevin Andrew Lipscomb - Gamium! - Shafiq ur Rehman - FibonacciFox

Please do consider supporting our project as well in exchange for access to nightly builds, earlier release build access, priority bug fixes, custom tutorials and a private Discord forum!