jphp-group / jphp

JPHP - an implementation of PHP on Java VM
http://jphp.develnext.org
Apache License 2.0
1.71k stars 161 forks source link
bytecode compiler java java-vm jit jphp jvm php php-language zend-php

JPHP - an implementation of PHP

Build Status

JPHP is a new implementation for PHP which uses the Java VM. It supports many features of the PHP language (7.1+).

How does it work? JPHP is a compiler like javac, it compiles php sources to JVM bytecode and then can execute the result on the Java VM.

In Production

We develop a new IDE for beginners like Game Maker or Scirra Construct. It's based on JPHP, JavaFX, Java 8, Gradle and allows to create desktop games and apps for Linux, Windows and Mac (maybe Android and other platforms in future). The project name is DevelNext (https://github.com/jphp-group/develnext-ide), the current status and version of the project is BETA. The project has not yet been localized in English.

Goals

JPHP is not a replacement for the Zend PHP engine or Facebook HHVM. We don’t plan to implement the zend runtime libraries (e.g. Curl, PRCE, etc.) for JPHP.

Our project started in October 2013. There were a few reasons for that:

  1. Ability to use java libraries in PHP (own extensions + other)
  2. Replacing the ugly runtime library of Zend PHP with a better runtime library.
  3. Using the PHP language not only on the web
  4. Multithreading like in Java and C#.
  5. Unicode Strings (Full Support for UTF-8, UTF-16).
  6. Creating GUI Android & Desktop applications on PHP language.

Features

What JPHP supports from PHP 7.2?

What JPHP supports from PHP 7.3?

What JPHP supports from PHP 7.4?

Own Extensions

Documentation

Getting started (Hello World)

  1. Install jphp package manager (jppm), how to install.
  2. Init new project (jppm package) with default values:
    jppm init
  3. Run in console jppm start.

You will see Hello World in your console, the sources of this program will be in src/index.php.

  1. (Optional) To update jphp version of your old project:
    jppm update jphp-core

How to run benchmarks?

// via jphp
./gradlew bench

// via php
php -f bench/src/bench.php

Build SNAPSHOT from sources

Use gradle install to build and install the jphp modules and libraries into the mavel local repository. After this, you can use jphp in your projects as a maven dependency.

org.develnext.jphp:jphp-<module>:<version>-SNAPSHOT