{"id":25782,"library":"javascript-to-php","title":"js2php","description":"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.","status":"deprecated","version":"0.1.7-c","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","php","transpiler","transcompiler"],"install":[{"cmd":"npm install javascript-to-php","lang":"bash","label":"npm"},{"cmd":"yarn add javascript-to-php","lang":"bash","label":"yarn"},{"cmd":"pnpm add javascript-to-php","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"runtime for CLI tool","package":"nodejs","optional":false}],"imports":[{"note":"This package is a CLI tool, not a library. There is no programmatic API.","wrong":"const js2php = require('javascript-to-php')","symbol":"default","correct":"// CLI tool only, no programmatic API"},{"note":"Use the command line. There are no JavaScript exports.","wrong":"","symbol":"CLI","correct":"js2php input.js > output.php"}],"quickstart":{"code":"// Install globally\nnpm install -g javascript-to-php\n\n# Convert a JavaScript file to PHP\njs2php examples/simple.js > simple.php\n\n# Or run directly\njs2php examples/class.js | php","lang":"javascript","description":"Install the CLI tool globally and convert a JavaScript file to PHP, then optionally run the PHP output."},"warnings":[{"fix":"Do not use in production. Consider alternative tools or manual translation.","message":"Package is experimental and should not be used in production.","severity":"gotcha","affected_versions":"*"},{"fix":"Use a maintained transpiler or avoid reliance on this package.","message":"No updates since 2016; likely unmaintained.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Only simple ES6 constructs are supported. Use a more comprehensive transpiler if needed.","message":"ES6 features like Promises, async/await, generators are not supported.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install -g javascript-to-php` to install globally.","cause":"Package not installed globally or locally.","error":"Error: Cannot find module 'javascript-to-php'"},{"fix":"Ensure npm global bin is in PATH or install locally via `npx javascript-to-php`.","cause":"Missing global install or PATH issue.","error":"js2php: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}