{"id":18084515,"url":"https://github.com/endel/js2php","last_synced_at":"2025-04-05T15:07:50.559Z","repository":{"id":20472564,"uuid":"23750130","full_name":"endel/js2php","owner":"endel","description":"JavaScript (ES6) to PHP source-to-source transpiler.","archived":false,"fork":false,"pushed_at":"2019-05-04T12:11:16.000Z","size":939,"stargazers_count":333,"open_issues_count":16,"forks_count":41,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-29T14:11:27.686Z","etag":null,"topics":["javascript","php","transpiler"],"latest_commit_sha":null,"homepage":"https://endel.github.io/js2php/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/endel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-07T01:47:50.000Z","updated_at":"2024-07-21T07:16:36.000Z","dependencies_parsed_at":"2022-07-31T21:08:11.623Z","dependency_job_id":null,"html_url":"https://github.com/endel/js2php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Fjs2php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Fjs2php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Fjs2php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Fjs2php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endel","download_url":"https://codeload.github.com/endel/js2php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353746,"owners_count":20925329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","php","transpiler"],"created_at":"2024-10-31T15:07:03.215Z","updated_at":"2025-04-05T15:07:50.538Z","avatar_url":"https://github.com/endel.png","language":"JavaScript","readme":"js2php\n===\n\n[![Build status](https://travis-ci.org/endel/js2php.svg?branch=master)](https://travis-ci.org/endel/js2php)\n\nJavaScript to PHP source-to-source transpiler.  [Online demo](http://endel.github.io/js2php)\n\n**This is an experiment. Please do not use it.**\n\nInstallation\n---\n\n- Install [nodejs](http://nodejs.org/)\n- Install js2php globally: `npm install -g js2php`\n\nUsage\n---\n\nConvert a single JavaScript file into PHP:\n\n```\njs2php examples/simple.js \u003e simple.php\n```\n\nSince `js2php` outputs the PHP code to stdout, you may run it right after\nconversion:\n\n```\njs2php examples/class.js | php\n```\n\nFeatures\n---\n\nWhat does it converts?\n\n- Classes (ES6)\n- Getters and Setters (ES6)\n- Namespaces (ES6)\n- Loops (while / for / do-while / for-of / for-in)\n- Arrow functions (ES6)\n- Template strings (ES6)\n- Functions and closures\n- Conditionals\n- [Core JavaScript](core)\n  - Array\n    - Array.prototype.unshift\n    - Array.prototype.shift\n    - Array.prototype.reverse\n    - Array.prototype.push\n    - Array.prototype.pop\n    - Array.prototype.join\n    - Array.prototype.splice\n    - Array.prototype.indexOf\n    - Array.prototype.length\n  - JSON\n    - JSON.parse\n    - JSON.stringify\n  - Math\n    - Math.E\n    - Math.LN2\n    - Math.LN10\n    - Math.LOG2E\n    - Math.LOG10E\n    - Math.PI\n    - Math.SQRT2\n    - Math.SQRT1_2\n    - Math.abs\n    - Math.acos\n    - Math.acosh\n    - Math.asin\n    - Math.asinh\n    - Math.atan\n    - Math.atanh\n    - Math.atan2\n    - Math.cbrt\n    - Math.ceil\n    - Math.clz32\n    - Math.cos\n    - Math.cosh\n    - Math.exp\n    - Math.expm1\n    - Math.floor\n    - Math.hypot\n    - Math.log\n    - Math.log1p\n    - Math.log10\n    - Math.max\n    - Math.min\n    - Math.pow\n    - Math.random\n    - Math.round\n    - Math.sin\n    - Math.sinh\n    - Math.sqrt\n    - Math.tan\n    - Math.tanh\n  - Number\n    - Number.isInteger\n    - Number.isFinite\n  - String\n    - String.prototype.replace\n    - String.prototype.trim\n    - String.prototype.trimRight\n    - String.prototype.trimLeft\n    - String.prototype.toUpperCase\n    - String.prototype.toLowerCase\n    - String.prototype.split\n    - String.prototype.substr\n    - String.prototype.match\n  - Function\n    - Function.prototype.apply\n    - Function.prototype.call\n  - Date\n    - Date.now\n\nTesting\n---\n\nTests are simple input (js) / output (php) comparisions.\n\n1. Create your source `.js` file at `test/fixtures/js_feature.js`\n2. Convert your `.js` to `.php` manually: `node test/generate.js js_feature.js`\n3. Run `npm test`\n\nLicense\n---\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendel%2Fjs2php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendel%2Fjs2php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendel%2Fjs2php/lists"}