Documentation

php2go documentation

A practical user guide: prepare a ZIP, choose an entrypoint, run allowed commands, download the artifact, and understand common compiler errors.

Fast path to the first build
  1. Pack the project into a ZIP without secrets or junk files.
  2. Make sure the entrypoint exists, usually public/index.php.
  3. Run report/check/deps before compile.
  4. Download the artifact and run the binary using README_RUN.
PIPELINE

How compilation works

Builds follow a clear pipeline. When something fails, the log shows the stage, file, line, and reason so the problem can be fixed without guessing.

Parse The compiler reads the entrypoint and PHP files, validates syntax, and builds the program tree.
Autoload Composer maps and project classes are loaded; unused files are kept out where analysis can prove it.
Analyze Types, reachable code, calls, properties, arrays, superglobals, and possible runtime fallbacks are analyzed.
Generate Go PHP constructs become Go: direct calls, typed locals, fast array/string helpers, and runtime only where PHP semantics require it.
Go build The generated project is compiled with standard go build into a binary.
Artifact The result is packaged with manifest, checksum, logs, and README_RUN.
How to read log stages

Parse means syntax or require, FinalCheck means unknown classes/functions, Codegen means Go generation, and GoBuild means an error in the generated Go project.

php2go: stage=Analyze static analysis
php2go: stage=Codegen generate Go
php2go: stage=GoBuild command=go build -mod=mod
compile_report: ok