hphp command line
One binary does everything: check, run, build. The runtime and the whole
standard library are embedded inside hphp.exe — nothing else to install.
Commands
| Command | What it does |
|---|---|
hphp check file.hphp | Type + borrow check only. Fastest feedback loop; prints OK (types and borrows check) or precise diagnostics with line numbers. |
hphp run file.hphp | Compile to a temp binary and execute it. Perfect for scripts and quick iteration. |
hphp build file.hphp -o app.exe | Produce a standalone executable. Ships with the runtime linked in — no dependencies on the target machine. |
hphp emit file.hphp | Print the generated C (for the curious and the debugger-inclined). |
Environment variables
| Variable | Effect |
|---|---|
HPHP_VERBOSE=1 | Show the backend compile/link commands and diagnostics detail. |
HPHP_KEEP_BIN=1 | Keep the intermediate build directory (prog.c, objects) for inspection. |
Typical workflow
hphp check app.hphp # instant: types + borrows
hphp run app.hphp # quick run
hphp build app.hphp -o app.exe # ship it
Editor support
A VS Code extension lives in extension/hphp: syntax highlighting,
completions for all 235 builtins (generated from the compiler's own table), hover
signatures, and live diagnostics that run hphp check as you type.
Under the hood
The pipeline is: lexer → recursive-descent parser → semantic analysis (types, borrows, ownership) → C codegen → cc + ld. The runtime (values, strings, COW arrays, exceptions, Win32 UI, sockets) is embedded in the compiler binary and extracted at build time, compiled with your local gcc, and linked statically — which is why output exes are a few hundred KB and start instantly.