API Index — Namespaces, Packages, Reports, Indices
ApiIndex
in package
Builds a curated landing for /docs/api/ from the phpDocumentor output.
phpDocumentor's own index is a flat "Table of Contents" dump (Packages
→ Namespaces → a long list of loose functions) that buries the classes
a reader actually wants. This class scans the generated
public/docs/api/classes/*.html files and groups them by namespace
(Core, HTTP, Middleware, Session, …) so the landing surfaces every
class directly. It's regenerated from the files on each request, so it
never drifts as classes are added or removed.
Also provides the breadcrumb trail shown atop each wrapped API page — the phpDocumentor header (which carried its own breadcrumb) is stripped during wrapping, so we synthesise one from the file path.
Table of Contents
Constants
- GROUP_TITLES : array<string, string> = ['Core' => 'Core', 'HTTP' => 'HTTP', 'Middlewar...
- Preferred group order + display titles. Groups not listed here (future namespaces) are appended alphabetically after these.
Methods
- breadcrumb() : array<int, array{label: string, href: ?string}>
- Breadcrumb trail for an API page, derived from its path relative to /docs/api (e.g. "/classes/ZealPHP-Middleware-CorsMiddleware.html").
- groups() : array<string, array<int, array{label: string, href: string}>>
- Group the generated class pages by namespace.
Constants
GROUP_TITLES
Preferred group order + display titles. Groups not listed here (future namespaces) are appended alphabetically after these.
private
array<string, string>
GROUP_TITLES
= ['Core' => 'Core', 'HTTP' => 'HTTP', 'Middleware' => 'Middleware', 'Session' => 'Session', 'Legacy' => 'Legacy / CGI', 'Cache' => 'Cache', 'Log' => 'Logging', 'Input' => 'Input', 'Diagnostics' => 'Diagnostics', 'Docs' => 'Docs', 'Learn' => 'Learn (demo app)']
Methods
breadcrumb()
Breadcrumb trail for an API page, derived from its path relative to /docs/api (e.g. "/classes/ZealPHP-Middleware-CorsMiddleware.html").
public
static breadcrumb(string $rel) : array<int, array{label: string, href: ?string}>
The last segment has a null href (current page).
Parameters
- $rel : string
Return values
array<int, array{label: string, href: ?string}>groups()
Group the generated class pages by namespace.
public
static groups(string $classesDir) : array<string, array<int, array{label: string, href: string}>>
Parameters
- $classesDir : string
Return values
array<string, array<int, array{label: string, href: string}>> —Display-title → list of {short class label, page href}, in the preferred group order.