{"id":25631,"library":"glayzzle","title":"Glayzzle","description":"Glayzzle is a PHP-to-JavaScript transpiler and CLI that allows running PHP scripts using Node.js or in the browser. As of version 0.3.0 (released circa 2016), it is a proof-of-concept with limited functionality: basic PHP syntax transpilation, file execution via CLI, and a simple server mode using Node.js cluster. It does not support many PHP features like PDO, dynamic variable names, or full function libraries. The project appears to be pre-alpha and is not suitable for production use. Differentiators: transpiles PHP to JS using generators/promises for async I/O, targets Node.js ecosystem.","status":"abandoned","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/glayzzle/glayzzle","tags":["javascript","php","transpiler"],"install":[{"cmd":"npm install glayzzle","lang":"bash","label":"npm"},{"cmd":"yarn add glayzzle","lang":"bash","label":"yarn"},{"cmd":"pnpm add glayzzle","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for PHP syntax parsing","package":"php-parser","optional":false}],"imports":[{"note":"Package is CommonJS only; no ES module or TypeScript types available. Use require().","wrong":"import glayzzle from 'glayzzle'","symbol":"glayzzle","correct":"const glayzzle = require('glayzzle')"},{"note":"CLI binary 'glz' is the primary interface. Use -r for inline code, -f for files.","wrong":"glz -r \"echo 'hello';\"","symbol":"cli","correct":"npx glz -r 'echo \"hello\";'"},{"note":"Constructor is exported as property of module, not default export. Check version 0.3.0 exports.","wrong":"const g = new Glayzzle()","symbol":"Glayzzle API","correct":"const Glayzzle = require('glayzzle').Glayzzle; const g = new Glayzzle()"}],"quickstart":{"code":"const glayzzle = require('glayzzle');\nconst glz = new glayzzle.Glayzzle();\n// Transpile a simple PHP snippet\nglz.eval('echo \"Hello from PHP!\";').then(output => {\n  console.log(output);\n}).catch(err => {\n  console.error(err);\n});","lang":"javascript","description":"Shows how to use Glayzzle programmatically to transpile and execute a simple PHP echo statement in Node.js."},"warnings":[{"fix":"Do not use for production. Check feature list before using.","message":"Package is proof-of-concept; most PHP features not supported (PDO, mysql, dynamic variables).","severity":"gotcha","affected_versions":"<=0.3.0"},{"fix":"Look for alternatives like phpto.js or use php-wasm in browser.","message":"Last version 0.3.0 from 2016; no updates or maintenance.","severity":"deprecated","affected_versions":"*"},{"fix":"Use WSL or Docker on Windows.","message":"CLI may not work on Windows due to unix-style paths and dependencies.","severity":"breaking","affected_versions":"*"},{"fix":"Use promises and avoid blocking I/O patterns.","message":"Asynchronous transpilation uses promises; synchronous PHP code blocks Node event loop.","severity":"gotcha","affected_versions":"*"},{"fix":"Rewrite PHP logic in JavaScript or use polyfills.","message":"No PHP library support; built-in functions like array_merge are not implemented.","severity":"breaking","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install php-parser","cause":"Missing dependency php-parser not installed automatically.","error":"Cannot find module 'php-parser'"},{"fix":"const { Glayzzle } = require('glayzzle')","cause":"Incorrect import pattern; used default import instead of named import.","error":"TypeError: glayzzle.Glayzzle is not a constructor"},{"fix":"Simplify PHP code or use alternative transpiler.","cause":"Glayzzle does not support full PHP syntax, e.g., short array syntax [], closures, etc.","error":"Error: PHP syntax error: unexpected token"},{"fix":"Run npx glz instead of glz, or install globally with npm install -g glayzzle","cause":"glz is not in PATH or not installed globally.","error":"bash: glz: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}