PHPackages                             allejo/rosetta-php-script - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. allejo/rosetta-php-script

ActiveApplication[Utility &amp; Helpers](/categories/utility)

allejo/rosetta-php-script
=========================

A library for translating JavaScript into PHP

0.0.0(3y ago)219MITPHPPHP &gt;=8.1

Since May 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/allejo/Rosetta-PhpScript)[ Packagist](https://packagist.org/packages/allejo/rosetta-php-script)[ Fund](https://www.buymeacoffee.com/allejo)[ GitHub Sponsors](https://github.com/allejo)[ RSS](/packages/allejo-rosetta-php-script/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (3)Used By (0)

Rosetta PhpScript
=================

[](#rosetta-phpscript)

Oh dear god, why does this even exist?!

The highlight.php project is a PHP port of the highlight.js project allowing for server-side syntax highlighting. The highlight.php project is used widely in the PHP community ranging from a WordPress plugin to Symfony related websites to Laravel plugins. As highlight.js evolved, so did their grammar definitions allowing for intricate callbacks to be used. This made keeping highlight.php near impossible unless I wanted to maintain 190+ languages manually. Enter this project: parse JS grammar definitions and rewrite them as PHP grammar definitions.

Does this mean you can use this tool to convert JavaScript code into production-ready PHP code? Please no. Never do this! The amount of security holes that could be introduced because of that... The purpose of this tool is solely to translate pretty basic highlight.js grammars. So then why did I make this open source? Because it may help someone else with their niche use case.

How does it work?
-----------------

[](#how-does-it-work)

It uses Babel's parser to read JavaScript code and convert it into an abstract syntax tree (AST). Then we convert that AST into an AST that nikic's PHP-Parser supports and writes out the PHP.

License
-------

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1095d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d66778910a0fa5d2df6f837ebcb61c9b2385767450d7e7325b4afa637b205988?d=identicon)[allejo](/maintainers/allejo)

---

Top Contributors

[![allejo](https://avatars.githubusercontent.com/u/1246453?v=4)](https://github.com/allejo "allejo (37 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/allejo-rosetta-php-script/health.svg)

```
[![Health](https://phpackages.com/badges/allejo-rosetta-php-script/health.svg)](https://phpackages.com/packages/allejo-rosetta-php-script)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
