项目作者: glayzzle

项目描述 :
:cactus: Transpiler API to convert php-parser AST to Javascript
高级语言: JavaScript
项目地址: git://github.com/glayzzle/php-transpiler.git
创建时间: 2017-01-20T11:29:05Z
项目社区:https://github.com/glayzzle/php-transpiler

开源协议:BSD 3-Clause "New" or "Revised" License

下载


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 :

  1. npm install php-transpiler --save

Usage

  1. // initialize the php parser factory class
  2. var transpiler = require('php-transpiler');
  3. var instance = new transpiler({
  4. browser: true // says if we generate code for browser or nodejs
  5. });
  6. var jsCode = instance.read('<?php echo "Hello World";');
  7. console.log(jsCode);

Will output :

  1. module.exports = function($php) {
  2. $php.stdout.print ('hello world');
  3. };

Misc

This library is released under BSD-3 license clause.