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

list

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: 15 Imported by: 0

Documentation

Overview

Package list builds a markdown inventory of PHP routes, files and classes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandFiles

func ExpandFiles(paths []string) ([]string, error)

ExpandFiles resolves path arguments to a sorted list of PHP file paths. Path forms match Go's package patterns:

  • "." or "dir": .php/.phpt files in that directory only (non-recursive)
  • "./..." or "dir/...": that directory and all subdirectories
  • "file.php": that file

When paths is empty, "." is used.

func Markdown

func Markdown(rows []Row) string

Markdown renders rows as an indented, padded GitHub-flavoured markdown table.

func StdlibMarkdown added in v0.5.0

func StdlibMarkdown(symbols []Symbol) string

StdlibMarkdown renders the registered surface as a markdown table, the same shape Markdown gives a source listing.

Types

type PathGroup added in v0.4.0

type PathGroup struct {
	Dir     string
	Indexes []int
}

PathGroup is the paths of one folder: Dir holds the folder, "." when the paths sit in the run directory, and Indexes the positions of its paths in the input slice, so a caller can carry per-path data alongside without the group copying it.

func GroupByDir added in v0.4.0

func GroupByDir(paths []string) []PathGroup

GroupByDir buckets paths by the folder holding them, preserving the order the input established both between folders and inside one. Bucketing is explicit rather than relying on the sort, because sorted paths do not keep a folder contiguous: a/b.php, a/m/x.php and a/z.php interleave.

type Row

type Row struct {
	Route    string // e.g. "GET /users/{id}", "@startup", or empty
	Filename string // slash-separated path relative to the working directory
	Classes  string // comma-separated FQNs, or empty
}

Row is one markdown table row.

func File

func File(path string) ([]Row, error)

File returns inventory rows for one PHP source file.

func Paths

func Paths(paths []string) ([]Row, error)

Paths scans path arguments and returns inventory rows.

type Symbol added in v0.5.0

type Symbol struct {
	Kind      string // "function", "class", "method" or "constant"
	Name      string
	Signature string // PHP declaration, or the value for a constant
}

Symbol is one name the runtime answers to, as a script would type it.

func Stdlib added in v0.5.0

func Stdlib() []Symbol

Stdlib returns everything the standard CLI runtime registers: the functions, the classes and their methods, and the constants.

It answers from the runtime rather than from a checked-in list, so a build reports what that build actually binds. What it cannot report is the doc comment written next to each registration, or the PHP spelling of a parameter name: both are read out of the Go source, which a shipped binary does not carry. Those live in docs/reference/extensions/implemented-apis.md, generated by the same reflection plus a source scan.

Jump to

Keyboard shortcuts

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