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 today

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 21% 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

1143d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1246453?v=4)[Vladimir Jimenez](/maintainers/allejo)[@allejo](https://github.com/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

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M24.9k](/packages/friendsofphp-php-cs-fixer)[drupal/core

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

21866.0M1.7k](/packages/drupal-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M415](/packages/drupal-core-recommended)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M563](/packages/shopware-core)

PHPackages © 2026

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