Skip to content

SamuelOcampo/php-transpiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-transpiler

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

npm version Build Status Coverage Status Gitter

Installation

This library is distributed with npm :

npm install php-transpiler --save

Usage

// 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');
};

Misc

This library is released under BSD-3 license clause.

About

🌵 Transpiler API to convert php-parser AST to Javascript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.8%
  • PHP 2.2%