Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Framework to develop simple Eclipse plugin using PHP/PHPinJava

Mapping PHP functions to Java methods

This is a step by step tutorial showing the capabilities of the current release.


  • Develop a Hello, World! plugin
  • The String "Hello, World!" is generated from evaluation a PHP script

Steps to reproduce

  • Install the plugin
  • Create a new plugin project (Name it testproject)
  • Use the template "Hello, World"
  • In the Dependencies tab add org.eclipse.soc2007.phpengine as a Required Plugin-ins
  • Create a PHP file
    • Create a file helloWorld.php under project root.
    • Add contents "<? echo "Hello, World Eclipse from PHP"; ?>"
  • Create a new interface
    • Use the package testproject.actions
    • Name it HelloWorld
    • Annotate the class with:
    • Add a method String getHelloWorld(String name);
    • Annotate the method with:
  • The template should have created a Java file testproject/actions/
public class SampleAction implements IWorkbenchWindowActionDelegate {
  • Add a private field
private HelloWorld helloWorld;
  • Modify the constructor (Activator is testproject.Activator)
helloWorld = (HelloWorld)PhpScriptableFactory.newInstance(
  • Modify the run method
	public void run(IAction action) {
			"SamplePlugin Plug-in",
  • Launch the Run
  • From the top menu choose Sample Menu -> Sample Action
  • Use should see a dialog telling you "Hello World 'YourName'"
  • Not seeing the desired output?
    • Be sure to check if the installed plugin and the fragment are in the Run plugins list.

Back to the top