endel / Js2php
Licence: mit
JavaScript (ES6) to PHP source-to-source transpiler.
Stars: ✭ 290
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Js2php
sugartex
SugarTeX is a more readable LaTeX language extension and transcompiler to LaTeX. Fast Unicode autocomplete in Atom editor via https://github.com/kiwi0fruit/atom-sugartex-completions
Stars: ✭ 74 (-74.48%)
Mutual labels: transpiler
rewrite-imports
Rewrite `import` statements as `require()`s; via RegExp
Stars: ✭ 31 (-89.31%)
Mutual labels: transpiler
Headache
Programming Language that compiles to 8 Bit Brainfuck
Stars: ✭ 59 (-79.66%)
Mutual labels: transpiler
go-mlog
Go to Mindustry (MLOG) compiler, runtime and decompiler (WIP)
Stars: ✭ 19 (-93.45%)
Mutual labels: transpiler
Il2c
IL2C - A translator for ECMA-335 CIL/MSIL to C language.
Stars: ✭ 270 (-6.9%)
Mutual labels: transpiler
grizzly
A Python-to-SQL transpiler as replacement for Python Pandas
Stars: ✭ 27 (-90.69%)
Mutual labels: transpiler
grumpy
Grumpy is a Python to Go source code transcompiler and runtime.
Stars: ✭ 378 (+30.34%)
Mutual labels: transpiler
js-slang
Implementations of the Source languages, which are small sublanguages of JavaScript designed for SICP JS
Stars: ✭ 41 (-85.86%)
Mutual labels: transpiler
Go2SourcePawn
Go2SourcePawn is a transpiler that transforms a subset of Golang-like code to equivalent SourcePawn.
Stars: ✭ 13 (-95.52%)
Mutual labels: transpiler
escapin
Escapin is a JS/TS transpiler for escaping from complicated usage of cloud services and APIs
Stars: ✭ 20 (-93.1%)
Mutual labels: transpiler
wxml-transpiler
Port of wcc.exe to JavaScript. wxml 文件编译器 --- 里面有很多无用代码,有空再整理下
Stars: ✭ 21 (-92.76%)
Mutual labels: transpiler
BashClass
BashClass is an Object Oriented Programming language that compiles to BASH 4.4
Stars: ✭ 40 (-86.21%)
Mutual labels: transpiler
Go On Rails
🚄 Use Rails to Develop or Generate a Golang Application.
Stars: ✭ 275 (-5.17%)
Mutual labels: transpiler
idealingua-v1
IdeaLingua RPC for Scala, TypeScript, C#, Go
Stars: ✭ 13 (-95.52%)
Mutual labels: transpiler
js2php
JavaScript to PHP source-to-source transpiler. Online demo
This is an experiment. Please do not use it.
Installation
- Install nodejs
- Install js2php globally:
npm install -g js2php
Usage
Convert a single JavaScript file into PHP:
js2php examples/simple.js > simple.php
Since js2php
outputs the PHP code to stdout, you may run it right after
conversion:
js2php examples/class.js | php
Features
What does it converts?
- Classes (ES6)
- Getters and Setters (ES6)
- Namespaces (ES6)
- Loops (while / for / do-while / for-of / for-in)
- Arrow functions (ES6)
- Template strings (ES6)
- Functions and closures
- Conditionals
-
Core JavaScript
- Array
- Array.prototype.unshift
- Array.prototype.shift
- Array.prototype.reverse
- Array.prototype.push
- Array.prototype.pop
- Array.prototype.join
- Array.prototype.splice
- Array.prototype.indexOf
- Array.prototype.length
- JSON
- JSON.parse
- JSON.stringify
- Math
- Math.E
- Math.LN2
- Math.LN10
- Math.LOG2E
- Math.LOG10E
- Math.PI
- Math.SQRT2
- Math.SQRT1_2
- Math.abs
- Math.acos
- Math.acosh
- Math.asin
- Math.asinh
- Math.atan
- Math.atanh
- Math.atan2
- Math.cbrt
- Math.ceil
- Math.clz32
- Math.cos
- Math.cosh
- Math.exp
- Math.expm1
- Math.floor
- Math.hypot
- Math.log
- Math.log1p
- Math.log10
- Math.max
- Math.min
- Math.pow
- Math.random
- Math.round
- Math.sin
- Math.sinh
- Math.sqrt
- Math.tan
- Math.tanh
- Number
- Number.isInteger
- Number.isFinite
- String
- String.prototype.replace
- String.prototype.trim
- String.prototype.trimRight
- String.prototype.trimLeft
- String.prototype.toUpperCase
- String.prototype.toLowerCase
- String.prototype.split
- String.prototype.substr
- String.prototype.match
- Function
- Function.prototype.apply
- Function.prototype.call
- Date
- Date.now
- Array
Testing
Tests are simple input (js) / output (php) comparisions.
- Create your source
.js
file attest/fixtures/js_feature.js
- Convert your
.js
to.php
manually:node test/generate.js js_feature.js
- Run
npm test
License
MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].