Transpiler API to convert php-parser AST to a Javascript output. This library is used to run a php script with :
- PHP Runtime - the API compliant with PHP Transpiler output
- Glayzzle - the nodejs CLI that runs PHP Files
This library is distributed with npm :
npm install php-transpiler --save
// initialize the php parser factory class
var transpiler = require('php-transpiler');
var instance = new transpiler({
browser: true // says if we generate code for browser or nodejs
});
var jsCode = instance.read('<?php echo "Hello World";');
console.log(jsCode);
Will output :
module.exports = function($php) {
$php.stdout.print ('hello world');
};
This library is released under BSD-3 license clause.