Tech Pulse

Peachpie lets PHP complied files to be executed in .NET framework

  • By Sairam
  • New York, NY
  • 2 min read
Peachpie lets PHP complied files to be executed in .NET framework - Tech Pulse | Indiapulse

After the announcement of making .NET framework an open-source resource, Microsoft continued its open-source revolution by making its Roslyn complier technology an open-source resource too. This powerful compiler can enable the developer to compile codes of C# to JavaScript and thereby enabling an interactive scripting environment with C#.

Now a recently unveiled Roslyn-based compiler project named Peachpie allows PHP to be compiled into portable class libraries and executed in the .Net framework.

In addition to possible performance gains, compiling to .Net provides PHP developers access to the existing culture of software written for .Net, as well as features of the .Net runtime itself.

Another advantage of using Roslyn: It generates abstract syntax trees (ASTs) from PHP code. Allowing the source code to be transformed by the compiler and made available to the user makes it easier to write analysis tools or applications that modify the behavior of other applications.

Peachpie stems from an earlier project named Phalanger, a PHP runtime and compiler for .Net. Provided as a toolset for Visual Studio 2010 through 2015, Phalanger enabled such tasks as debugging a PHP website directly in Visual Studio.

Many features planned for Peachpie aren't available yet, as the current emphasis is on providing a working example of the technology. For now, the parser supports only PHP 5, although support for PHP 7 is planned. A basic implementation of the AST is available, but plans are under way to build ASTs using Roslyn's advanced ISymbol interface. And none of the .Net-related reflection or introspection tools are available yet.

PHP's broad deployment -- it's been in use for 20 years -- guarantees it will remain a common technology choice for rapid Web development. With PHP 7, the language enjoyed a major performance boost and gained its own abstract syntax tree functionality, among other feats.

But PHP's inconsistent design and piecemeal evolution opened up opportunities for other platforms, such as Node.js, to step in and offer a more modern set of solutions. (PHP debugging, for instance, has long been problematic).

Peachpie isn't likely to arrest that trend, but it will at least provide a way for both .Net and PHP developers to leverage what each development environment has to offer: PHP's breadth of existing applications and development expertise and .Net's runtime and metaprogramming facilities.

Share this article

Sairam

Sairam writes for Indiapulse on Tech Pulse for Indians across the US.

Stay Connected to Indian America

Get the latest community stories, local events, entertainment and lifestyle updates delivered to your inbox.

Sulekha AppIt’s faster & better
Open in App