Phalanger (compiler)

Last updated
Phalanger
Stable release
3.0.0.3851 / January 2013;10 years ago (2013-01)
Repository
Written in C#, C++/CIL
Operating system Cross-platform
Platform .NET Framework
License Apache License (Apache 2)
Website www.php-compiler.net

Phalanger is a compiler front end for compiling PHP source code into CIL byte-code, which can be further processed by the .NET Framework's just-in-time compiler. The project was started at Charles University and is supported by Microsoft. Phalanger was discontinued in favor of the more modern PeachPie compiler, which utilizes the Roslyn API.

Contents

Compatibility

Phalanger can run real-world PHP applications, many with minor to no modifications. Examples include WordPress, [1] phpMyAdmin and phpBB. [2]

Performance

One of the main goals of the project is to improve performance of PHP applications. The project web page claims considerable performance benefits over a 32-bit Windows version of PHP. [3]

There was a project [4] at Charles University to re-implement the Phalanger core using the Microsoft Dynamic Language Runtime (DLR), and to develop a Visual Studio integration tool to provide IntelliSense for the PHP language.

Though some features from DLR would slow down the performance of Phalanger[ citation needed ], they do claim performance gains by a factor of 6. [5] These features are being integrated into current Phalanger core.

Google Summer of Code

A project involving Phalanger was mentored by the Mono team during the Google Summer of Code program in 2008. During this period Phalanger was ported to the Silverlight 2.0 framework with the goal of making it work on Moonlight as well. [6]

Jadu sponsorship

Early in 2008, UK Content Management vendor Jadu partnered with the Prague-based team to improve communication between .NET and the Phalanger compiler. It is based on duck typing and provides a way for accessing objects from the dynamic PHP world that lack compile-time type information from a statically typed language in a .NET environment in a type-safe way. [7]

In December 2008, Jadu announced that it has made the compiler available to the developer community and in interviews with ITPRO [8] and VNUnet [9] said that the development would help close the skills gap between PHP and .NET.

Devsense support & development

Since 2009, DEVSENSE company leads the development of the project and offers commercial support. [10] DEVSENSE consists of core Phalanger developers and keeps this open-source project alive.

In addition to maintenance and growth of the project, Devsense is providing Visual Studio integration of Phalanger for the community. [11]

Since 2012, DEVSENSE provides support forum [12] for Phalanger (compiler) and related projects for the community.

Legacy

The last PHP version supported by Phalanger is 5.4. The GitHub project is marked "Deprecated" and (as of 2019) it hasn't been updated for years. The GitHub page also announces a new project, PeachPie compiler as its successor for PHP 7.1. [13] PeachPie can compile code using PHP 5.4 syntax or newer, and is officially supported by .NET Foundation. [14]

See also

Related Research Articles

<span class="mw-page-title-main">PHP</span> Scripting language created in 1994

PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. PHP was originally an abbreviation of Personal Home Page, but it now stands for the recursive initialism PHP: Hypertext Preprocessor.

<span class="mw-page-title-main">Visual Basic (.NET)</span> Object-oriented computer programming language

Visual Basic (VB), originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language, the last version of which was Visual Basic 6.0. Although the ".NET" portion of the name was dropped in 2005, this article uses "Visual Basic [.NET]" to refer to all Visual Basic languages released since 2002, in order to distinguish between them and the classic Visual Basic. Along with C# and F#, it is one of the three main languages targeting the .NET ecosystem. Microsoft updated its VB language strategy on 6 February 2023, stating that VB is a stable language now and Microsoft will keep maintaining it.

ASP.NET is an open-source, server-side web-application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, applications and services. The name stands for Active Server Pages Network Enabled Technologies.

IronPython is an implementation of the Python programming language targeting the .NET Framework and Mono. The project is currently maintained by a group of volunteers at GitHub. It is free and open-source software, and can be implemented with Python Tools for Visual Studio, which is a free and open-source extension for Microsoft's Visual Studio IDE.

Jadu is a provider of low-code Web Experience Management software, specialising in Web CMS, Forms, Portal and Customer Case Management tools for the enterprise.

The Dynamic Language Runtime (DLR) from Microsoft runs on top of the Common Language Runtime (CLR) and provides computer language services for dynamic languages. These services include:

IronRuby is an implementation of the Ruby programming language targeting Microsoft .NET Framework. It is implemented on top of the Dynamic Language Runtime (DLR), a library running on top of the Common Language Infrastructure that provides dynamic typing and dynamic method dispatch, among other things, for dynamic languages.

<span class="mw-page-title-main">V8 (JavaScript engine)</span> Open-source JavaScript and WebAssembly engine developed by Google

V8 is a free and open-source JavaScript and WebAssembly engine developed by the Chromium Project for Chromium and Google Chrome web browsers. The project's creator is Lars Bak. The first version of the V8 engine was released at the same time as the first version of Chrome: 2 September 2008. It has also been used on the server side, for example in Couchbase, Deno and Node.js.

Text Template Transformation Toolkit is a free and open-source template-based text generation framework. T4 source files are usually denoted by the file extension ".tt".

IronScheme is an implementation of the Scheme programming language targeting the Microsoft .NET Framework. IronScheme is a complete rewrite of IronLisp, incorporating lessons learnt while developing IronLisp.

<span class="mw-page-title-main">.NET Framework</span> Software platform developed by Microsoft

The .NET Framework is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until being superseded by the cross-platform .NET project. It includes a large class library called Framework Class Library (FCL) and provides language interoperability across several programming languages. Programs written for .NET Framework execute in a software environment named the Common Language Runtime (CLR). The CLR is an application virtual machine that provides services such as security, memory management, and exception handling. As such, computer code written using .NET Framework is called "managed code". FCL and CLR together constitute the .NET Framework.

<span class="mw-page-title-main">Node.js</span> JavaScript runtime environment

Node.js is a cross-platform, open-source server environment that can run on Windows, Linux, Unix, macOS, and more. Node.js is a back-end JavaScript runtime environment, runs on the V8 JavaScript engine, and executes JavaScript code outside a web browser.

Windows Runtime (WinRT) is a platform-agnostic component and application architecture first introduced in Windows 8 and Windows Server 2012 in 2012. It is implemented in C++ and officially supports development in C++, Rust/WinRT, Python/WinRT, JavaScript-TypeScript, and the managed code languages C# and Visual Basic .NET (VB.NET).

<span class="mw-page-title-main">.NET</span> Free and open-source software platform developed by Microsoft

.NET is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems. It is a cross-platform successor to .NET Framework. The project is mainly developed by Microsoft employees by way of the .NET Foundation, and released under an MIT License.

X#, pronounced X sharp and often written XSharp, is an xBase-compatible programming language for the Microsoft .NET platform. X# has been built on top of Roslyn, the open source architecture behind the current Microsoft C# and Visual Basic .NET compilers.

Microsoft, a technology company historically known for its opposition to the open source software paradigm, turned to embrace the approach in the 2010s. From the 1970s through 2000s under CEOs Bill Gates and Steve Ballmer, Microsoft viewed the community creation and sharing of communal code, later to be known as free and open source software, as a threat to its business, and both executives spoke negatively against it. In the 2010s, as the industry turned towards cloud, embedded, and mobile computing—technologies powered by open source advances—CEO Satya Nadella led Microsoft towards open source adoption although Microsoft's traditional Windows business continued to grow throughout this period generating revenues of 26.8 billion in the third quarter of 2018, while Microsoft's Azure cloud revenues nearly doubled.

<span class="mw-page-title-main">PeachPie</span>

PeachPie is an open-source PHP language compiler and runtime for the .NET Framework and .NET. It is built on top of the Microsoft Roslyn compiler platform and is based on the first-generation Phalanger project. PeachPie compiles source code written in PHP to CIL byte-code. PeachPie takes advantage of the JIT compiler component of the .NET Framework in order to handle the beginning of the compilation process. Its purpose is not to generate or optimize native code, but rather to compile PHP scripts into .NET assemblies containing CIL code and meta-data. In July 2017, the project became a member of the .NET Foundation.

References

  1. Phalanger + Wordpress Archived 2011-08-17 at the Wayback Machine
  2. "phpBB: Creating communities twice as fast". Archived from the original on 2013-05-17. Retrieved 2013-02-19.
  3. "Benchmarks". www.php-compiler.net. Archived from the original on 2012-04-27.
  4. "Improvements in the Phalanger Project". www.php-compiler.net. 2008-07-01. Archived from the original on 2023-08-15. Retrieved 2011-07-09.
  5. "Phalanger takes advantage of DLR". 2011-08-01. Archived from the original on 2016-03-25. Retrieved 2011-08-03.
  6. "Google Summer of Code Application Information". 2007-04-21.[ permanent dead link ]
  7. Petricek, Tomas (2007-04-30). "Using PHP objects from C# in a type-safe way". Archived from the original on 2008-10-12. Retrieved 2008-11-30.
  8. Har-Even, Benny (2006-12-02). "Jadu gets PHP and .NET talking". ITPRO. Archived from the original on 2008-12-06. Retrieved 2008-12-03.
  9. Muncaster, Phil (2006-11-28). "Jadu brings PHP and .NET closer together". VNUnet. Archived from the original on 2008-12-04.
  10. "Devsense offers Phalanger and commercial support". DEVSENSE. Archived from the original on 2011-06-24.
  11. "Devsense provides Phalanger Tools". DEVSENSE. Archived from the original on 2011-10-17.
  12. "DEVSENSE support". DEVSENSE. Archived from the original on 2012-01-22. Retrieved 2012-01-24.
  13. "GitHub - DEVSENSE/Phalanger: PHP 5.4 compiler for .NET/Mono frameworks. Phalanger compiles legacy PHP code to MSIL while being fully compatible with PHP behavior". GitHub . Archived from the original on 2019-05-01. Retrieved 2019-04-19.
  14. "GitHub - peachpiecompiler/peachpie: PeachPie - the PHP compiler and runtime for .NET and .NET Core". GitHub . Archived from the original on 2019-07-20. Retrieved 2019-04-19.