Registry / serialization / javascript-to-php

javascript-to-php

JSON →
library0.1.7-cjsnpmunverified

A source-to-source transpiler that converts JavaScript (including ES6 features like classes, arrow functions, template strings, and namespaces) into PHP code. Current version 0.1.7-c is marked as experimental and not recommended for production use. It provides a CLI tool for file conversion and supports core JavaScript constructs, Array/JSON/Math/String methods, and Date. Maintained as a hobby project with no recent releases or active development.

npm install javascript-to-php
INSTALL
IMPORT
SIG · JAVASCRIPT-TO-PHP
J
javascript-to-php
serializationjavascriptv0.1.7-c
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
// CLI tool only, no programmatic API
const js2php = require('javascript-to-php')
This package is a CLI tool, not a library. There is no programmatic API.
CLI
js2php input.js > output.php
Use the command line. There are no JavaScript exports.

Install the CLI tool globally and convert a JavaScript file to PHP, then optionally run the PHP output.

// Install globally npm install -g javascript-to-php # Convert a JavaScript file to PHP js2php examples/simple.js > simple.php # Or run directly js2php examples/class.js | php
js2php --version
Debug
Known issues
gotchaPackage is experimental and should not be used in production.
fix
Do not use in production. Consider alternative tools or manual translation.
affects: *
deprecatedNo updates since 2016; likely unmaintained.
fix
Use a maintained transpiler or avoid reliance on this package.
affects: >=0.1.0
gotchaES6 features like Promises, async/await, generators are not supported.
fix
Only simple ES6 constructs are supported. Use a more comprehensive transpiler if needed.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'javascript-to-php'
Package not installed globally or locally.
fix
Run `npm install -g javascript-to-php` to install globally.
js2php: command not found
Missing global install or PATH issue.
fix
Ensure npm global bin is in PATH or install locally via `npx javascript-to-php`.
Upgrade
Version history
0.1.7-clatest on npm
Audit
Dependencies
nodejsrequiredruntime for CLI tool
Agent activity
6 hits · last 30 days
node
6
Resources
javascript-to-php — npm install javascript-to-php · libregistry