JPHP - an implementation of PHP
JPHP is a new implementation for PHP which uses the Java VM. It supports many features of the PHP language (5.6+).
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.
- Official Site: j-php.net
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:
- Ability to use java libraries in PHP
- Upgrading performance via JIT and JVM
- Replacing the ugly runtime library of Zend PHP with a better runtime library.
- Using the PHP language not only on the web
- Also: unicode for strings and threads
Features
- JIT (~2.5 faster PHP 5.6, ~1.1 faster PHP 7), Optimizer - Performance benchmarks
- Using java libraries and classes in PHP code.
- Unicode for strings (UTF-16, like in Java)
- Threading, Sockets, Environment architecture (like sandbox objects in the runkit zend extension).
- GUI (based on Swing, improved - more flexible layouts)
- Embedded cache system for classes and functions
- Optional Hot Reloading for classes and functions
- Ability to use on Android OS
What JPHP does not yet support?
- Importing namespaced functions (php 5.6)
Documentation
- Wiki here: read
- You can find the latest api documentation here: http://jphp-docs.readthedocs.org/
- To contribute to the api documentation, you can fork the
docs
project: https://github.com/jphp-compiler/docs
Getting started (Hello World)
http://j-php.net/wiki/Getting-started
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-core:<version>-SNAPSHOT