finds.dev

jordwalke/rehp

ReHp

View on GitHub

★ 224OCamlNOASSERTIONupdated Feb 2021

// the take

rehp is a fork of js_of_ocaml that adds a PHP/Hack compilation backend for Reason/OCaml. The idea is to introduce an intermediate representation (Rehp) that sits between OCaml bytecode and the target language, making it easier to add backends beyond JavaScript. It's for teams running OCaml/Reason who need to interop with a PHP codebase without rewriting everything.

The intermediate IR approach is architecturally sound — instead of bolting PHP onto js_of_ocaml's JS-specific IR, they introduce Rehp as a language-agnostic layer, which is the right call. The module template system for controlling per-file output format is genuinely useful for integrating with PHP autoloaders that expect specific file layouts. Built by jordwalke (creator of Reason), so the OCaml/Reason toolchain integration is not an afterthought. The esy-based build means you can drop it into an existing project without fighting your package manager.

Last commit is February 2021 — this is effectively abandoned. The README's own 'Next Steps' section describes the project as needing substantial rework (rewrite PHP stubs by hand, remove JS-to-PHP transpiler, simplify Rehp), meaning what ships is explicitly not the intended final architecture. Only targets Hack (HHVM's PHP variant), not standard PHP, which narrows the audience considerably since most shops aren't running HHVM in 2024. There are no docs on what OCaml stdlib features actually work in the PHP backend versus silently producing broken output — the test suite covers OCaml-to-JS scenarios inherited from js_of_ocaml, not PHP-specific behavior.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
224
Forks
16
Language
OCaml
License
NOASSERTION
Last commit
28 Feb 2021

// nearby

If rehp isn't quite it.

All repos →