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.
REPORTS

How to read report, check, and deps

These commands are not decorative. They show what the compiler actually saw in the project, which files are reachable, where dynamic behavior exists, and why a build may fail.

report Produces a project summary: files, classes, functions, reachable code, fallbacks, diagnostics, and final status.
check Checks the project without building a binary. Useful after fixes when you want quick feedback.
deps Shows dependencies and missing symbols. The --json format is useful for automated diagnostics.
compile Generates Go code, runs go build, and creates the artifact. Run it after report/check.

Important metrics

Good signs

  • errors=0 and understandable warnings.
  • Most calls became direct_calls or typed_ops.
  • fallback_hotspots are explainable and not in the hot runtime path.

Watch closely

  • E_CLASS_NOT_FOUND, E_FUNCTION_NOT_FOUND, and missing symbol.
  • Many CallMethodScoped, AnyKey, TypeAssert, and dynamic calls.
  • GoBuild errors: these are generated-Go issues and should be sent to support.
compile_report: ok
files=128 classes=84 functions=312
fallbacks_total=27 call_method=3 any_key=12
diagnostics=2 errors=0 warnings=2