The Runtime Converter is both a PHP to Java code conversion tool and a library "runtime" that in theory can support all useful aspects of PHP in Java.

​The language features emulated by the runtime library are things like copy on write, numeric and string indexed arrays, auto type comparison and conversion, as well as function calls and namespaces. The fullness of the PHP function and class library, including custom extensions is provided by a direct link to PHP embedded as a dynamic library.

PHP is a great language and quite fast, but there are many reasons to move to another language such as Java. Speed is one reason, for some use cases. Another is library compatibility - some things just aren't available for PHP in the same quality. More common is probably developer tools and preferences, as well as language features like type checking, compile time linking, multithreading, and shared memory.

The problem is that a manual conversion is a time and labor intensive process. This is where the Runtime Converter comes in. We attempt to build you a working project right from the start, so you can focus on getting your unit tests passed, and developing new features. Your new code will be native to your new language and will be reasonably readable. Also, because the conversion is fully automated, improvements can be made to the converter and runtime library and tested on your project while you continue to develop.

We have developed in Java approximately 300 functions out of the PHP standard library, along with various modules such as reflection, sessions, type comparison, operators, etc. We can selectively add to this list of Java functions so that a converted project does not need to include the embedded PHP library.

Successful Conversions

The Runtime Converter has over 750 unit tests consisting of non-trivial PHP scripts whose output is compared before and after the conversion. We have also a tracing tool that validates the call graph.

We have successfully converted the PHPUnit framework and run their demonstration tests. The laravel framework is a work-in-progress. It has reached the stage of runtime testing and is expected to soon be usable in converting projects based on laravel.

© 2017 RuntimeConverter