Skip to main content
Jump to: navigation, search

Gsoc/2010/proposals/E4 PHP

PHP support into e4

This is a 2009 Google Summer of Code project proposal.

Project description

The aim of this project is to leverage PHP/Java bridge for adding a PHP support into e4, the next generation of the Eclipse Platform. e4 has already a support for writing plug-ins in JavaScript using Rhino capabilities to interact between JavaScript and Java. The PHP Bundles and the Extension Registry Support will be identical to the one for the JavaScript support. The second step is to make this project get real around the PHP community by extending PDE to support PHP Plug-ins. This includes:

  • Manifest validation
  • Wizards for PHP Plug-in creation
  • Static code Analysis to resolve bundle/package dependencies
  • Writing extension points in PHP
  • Evangelism to the PHP community through a screencast.

The PHP Development Toolkit (PDT) project provides Eclipse for the PHP language. PDT and DLTK combined define more than 30 extension points, allowing PHP developers to integrate their own PHP frameworks and tools. However, PHP developers are often not familiar with Java and they need to use PHP not only for dynamic capabilities but also to integrate PHP-written libraries inside Eclipse. Using PHP as a runtime language for plug-in is also a great opportunity to script development workflows. The aim of this project is to leverage PHP/Java bridge for adding a PHP support into e4, the next generation of the Eclipse Platform and to extend PDE to support the creation of PHP plug-ins.

Using the e4 recipe

E4 JavaScript support defines OSGi bundles in JSON format that can be used to define a JavaScript bundle's metadata. We can reuse this mechanism for PHP bundles:


You could reference your PHP bundles using the "PHP-Bundle" header in the OSGi manifest. For example:

PHP-Bundle: scripts/bundle.json

The e4 support for PHP will provide a PHPFactory class to register extension points implemented in PHP.

            label="Sample Action Set"
               label="Sample &amp;Menu"
               label="&amp;Sample Action"
               tooltip="Hello, Eclipse world"

Subclassing and implementing Eclipse API will be done through annotation. PHP has runtime support for annotation with the addendum library [1].

 * @Interfaces({'org.eclipse.ui.IWorkbenchWindowActionDelegate'})
class HelloWorld
  private $window;
  public function run($action)
    $messageDialog = Java('org.eclipse.jface.dialogs.MessageDialog');
                                    'Hello e4 world');
  public function init($window)
    $this->window = $window;
  public function dispode(){}
  public function selectionChanged($action, $selection){}

PHP and Java chatting together

Using a PHP/Java bridge with EPL-compatible license, PHP can interact with Java on a single JVM instance, allowing it to script the Eclipse environnement. Java is capable of calling PHP code and interact with PHP objects through proxy classes dynamically generated. A shared runtime stack between PHP and Java allows both languages to exchange seamlessly parameters and returned values.

PDE support for PHP plug-ins

By Extending PDE builders we can assist the validation of PHP bundle. The aim of this project is also to use PDE extensibility to create custom wirzards for PHP plug-in creation.


Example of extension of PDE manifest builder:


Schedule of Code and Deliverables

The project timeline is available on Google Calendar [2]

Back to the top