Peachpie allows for a seamless both-way interoperability between PHP and .NET applications. In simpler terms, this means that one can have some parts of an application written in PHP, while other modules are written in .NET and everything will work together as one application. Without Peachpie, connecting these modules is tedious, time-consuming and often risky or producing unnecessary performance overhead.
A good example of how to leverage this technology is the American company AMain Hobbies. Using our compiler, AMain Hobbies was able to interconnect its PHP backend modules with other parts of their application that were written in .NET. You can read more about this particular example in the case study below.
Save money by re-using PHP instead of re-writing the same in C#
Seamless, simple connection between PHP and .NET code
Improve collaboration between developers in different teams
Extending PHP applications with C# (or vice versa)
One of the key advantages of Peachpie is the ability to enhance the vast codebase of PHP applications with plugins or extensions in C# (or any other .NET language). This further bridges the gap and allows one to use the best of both worlds, giving the developer more flexibility in choosing their preferred technology as needed.
Each language offers a distinct set of advantages and with Peachpie, you can leverage the strengths of both platforms to develop applications more efficiently and securely.
Extend popular PHP apps or frameworks with C#
Use secure and popular C# packages
Replace performance-critical modules with a C# implementation
Possibly the most frequent usage for Peachpie is to take an application in PHP and port it to .NET one-to-one, meaning that the application will be running on PHP and .NET simultaneously. There is a number of reasons why one would do this, as outlined below under the benefits section.
UK-based company Jadu, for example, used the predecessor of Peachpie, Phalanger, to launch a .NET-compliant version of its PHP-based CMS, thereby also supporting MS SQL, IIS and the .NET framework. Rather than writing a complete second version of their software and maintaining both, Jadu was able to port their PHP application to .NET entirely thanks to Phalanger. Please note that unlike what the article in the resources claims, Phalanger is not owned by Jadu.
Run PHP applications on the standardized, verifiable .NET runtime
The ability to use .NET tooling, like IDEs diagnostic or profiling
Although PHP has its own package distribution system, the unique ability to distribute PHP as a NuGet package thanks to Peachpie provides numerous advantages for the developer.
Not only does this option represent another effective way of injecting PHP into the .NET ecosystem, the NuGet package repository allows for a sourceless distribution of compiled PHP components – something the PHP composer will never permit.
Similarly to the ability to provide PHP code as a NuGet package, Peachpie also allows for code to be consumed as such. This offers another set of benefits to a company or project and take advantage of the many popular NuGet packages available within the .NET ecosystem.
The benefits of the NuGet distribution system over the regular PHP composer remain the same as above; this, however, also implies that one can specify dependencies on private NuGet packages without revealing their source code.
Specify dependencies on private NuGet packages
No need to reveal the source code
Access for PHP to a plethora of available NuGet packages
Migrating PHP apps to the .NET platform
Peachpie can be tremendously powerful for companies or projects looking to migrate their application to the .NET platform. Unlike any other available option, Peachpie allows one to do so piece-by-piece without the need to take the application down for testing.
Therefore, you can migrate just small parts of an application while it remains live at all times without the need for downtime. At the same time, one can simultaneously use NuGet packages to further speed up the process.
Migrate PHP apps to .NET sequentially and continuously
The app can stay live and never has to be taken down in the process
Performance-critical components can be sped up significantly
Note: Peachpie is a work in progress; the project’s compatibility with PHP features is subject to constant change.