Help us shape the future of Go! Take the 2026 Go Developer Survey

apidoc

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package apidoc generates docs/reference/extensions/implemented-apis.md. It combines two sources of truth: the live runtime, which says what is registered and with which Go signature, and a scan of the Go source, which carries the doc comment written next to each registration and the parameter names the reflect API cannot see. See scripts/list-apis for the entry point.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(rt *runner.Runtime, srcRoot string) (string, error)

Generate renders the implemented-apis markdown for the runtime rt, reading doc comments and parameter names from the Go source rooted at srcRoot.

func Reflect added in v0.5.0

func Reflect(rt *runner.Runtime) ([]Func, []Class)

Reflect is Generate's first half without the source scan: what the runtime registers, with the signature reflection can recover on its own. It is what a shipped binary can answer, since the Go source it was built from is not there to read doc comments and PHP-spelled parameter names out of. Those are the only things missing from the result; the names, types and returns are the same ones the generated reference is rendered from.

Types

type Class

type Class struct {
	Name    string
	Aliases []string
	Package string
	Comment []string
	Params  []Param // constructor parameters
	Methods []Method
}

Class is one registered class. Classes sharing a constructor (the SPL exception set) collapse into one entry with the extra names in Aliases.

func (Class) Signature added in v0.5.0

func (c Class) Signature() string

Signature renders the class constructor as a script would declare it.

type Func

type Func struct {
	Name    string
	Package string   // Go package directory relative to the module root
	Area    string   // subsection within the package, from the register* func
	Comment []string // doc comment lines without comment markers
	Params  []Param
	Returns string // PHP type name, "void" when the Go func returns nothing
}

Func is one registered function with everything the renderer needs.

func (Func) Signature added in v0.5.0

func (f Func) Signature() string

Signature renders the function as a script would declare it. A Class::method name is not declarable with the function keyword, so it is cited the way a script calls it instead.

type Method

type Method struct {
	Name    string // PHP spelling, snake_case
	Comment []string
	Params  []Param
	Returns string
}

Method is one PHP-callable method on a registered class.

func (Method) Signature added in v0.5.0

func (m Method) Signature() string

Signature renders the method as a script would declare it.

type Param

type Param struct {
	Name     string // without the dollar sign
	Type     string // PHP type name, empty for a by-reference out parameter
	Variadic bool
	ByRef    bool // the runner's by-reference setter wrapper
}

Param is one PHP-visible parameter of a binding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL