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). |
hphp create [name] | New project folder from a template (console, web, lib, empty). Asks a few questions in a terminal; --yes and the options from hphp create --help for scripts. |
hphp run / build / check | Without a file, inside a project: use the entry from hphp.yaml. hphp build then writes build/<name>. |
hphp install [pkg[@version]] | In a project: install everything from hphp.yaml into .hphp/packages/ (keeping hphp.lock), or add one dependency (--dev for require-dev, a folder such as ../mylib for a local package). Outside a project: install a package for your user, as before. |
hphp update [pkg] | Move dependencies to the newest version their constraint allows and rewrite hphp.lock. |
hphp remove pkg | Drop a dependency, its folder and whatever only it needed. |
hphp deps | List the locked dependencies and where they came from. |
hphp test [filter] [-v] | Run every tests/*.hphp of the project; a test passes when it exits 0. |
hphp pkg ... | Package manager: init, check, pack, publish, install, remove, search, registry, list, home. See the Packages page. |
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. |
HPHP_HOME | Package home: packages/, cache/, registry_url. Defaults to a per-user folder. |
HPHP_REGISTRY | Registry URL override (default: http://hphp.ch:8930 — the public community registry). |
HPHP_PATH | Extra import search directories, ; (Windows) or : separated — like PHP's include_path. |
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 305 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.