Apidoc / PHP · Go · Rust

One API docs layer.
Three languages.

Declare docs next to your handlers and get a browsable, debuggable, exportable API portal. PHP, Go and Rust share one document model and one static UI.

3backend languages
16framework adapters
1shared docs UI
12pet moods

One project family, one documentation experience.

Apidoc turns API docs from hand-written Markdown into declarations next to your code. PHP uses PHP 8 attributes, Go uses typed structs, and Rust uses proc macros. All three share one document model, live debugging and the same static front-end.

The PHP edition started from HGthecode/apidoc-php (hg/apidoc). Go, Rust and apidoc-ui are maintained by erikwang2013. Each language keeps its native setup while the documentation experience stays consistent.

From declaration to delivery, all three languages follow the same documentation pipeline.

PHP >= 8.0Go >= 1.24Rust >= 1.82MIT
Apidoc social preview with the pet and annotation code
Project family social preview. The pet and annotation code.

Pick your language first.

One documentation workflow, different declaration mechanisms, framework adapters and build times. Every language has its own guide.

PHPv1.0.6

PHP

Attribute-driven API docs for PHP 8

Write PHP 8 attributes in Laravel, ThinkPHP, Hyperf, Webman, Yii2 or Yii3 and get a browsable, debuggable, exportable API portal.

  • PHP 8 attributes
  • 6 framework adapters
  • definitions / ref / children
  • Debug, Mock, JSON/TS
composer require erikwang2013/apidoc-php
Gov1.0.7

Go

Typed docs registered with routes

Declare docs as typed structs next to route registration. A built-in web UI provides browsing and live debugging for net/http, Gin, Echo, Chi, Fiber, beego, Kratos and go-zero.

  • Typed Doc structs
  • 8 framework adapters
  • reflect + go/ast parsing
  • ETag, JSON/TS export
go get github.com/erikwang2013/apidoc-go
Rustv2.0.0

Rust

Proc-macro docs generated at compile time

Declare docs with proc macros on handlers, register them statically at compile time and aggregate at zero runtime cost. Works with axum and actix-web, with auth, Mock, exports, sharing and codegen built in.

  • 20+ attribute macros
  • axum / actix-web
  • linkme compile-time registry
  • HMAC auth, three exports
apidoc-rust = "2.0"
UIVue 3.5

apidoc-ui Guide

A Vue 3 + TypeScript documentation front-end with apps/versions, live debugging, sharing, Swagger export, cache management and i18n. The build output is fully static.

One static front-end for all three backends · Vue 3.5 · Vite 6 · Pinia · Monaco

npm ci && npm run build

One endpoint, three ways.

Keep your stack. Declare routes and docs in the language you already use; Apidoc handles generation, debugging and delivery.

User.php
use erikwang2013\apidoc\annotation as Apidoc;

#[Apidoc\Title("Get user")]
#[Apidoc\Method("GET")]
#[Apidoc\Url("/users/{id}")]
#[Apidoc\RouteParam(
    name: "id", type: "int"
)]
#[Apidoc\Returned(
    name: "name", type: "string"
)]
public function show(int $id) { }
main.go
s.Register(apidoc.Route{
    Method: "GET",
    URL:    "/users/:id",
    Handler: getUser,
    Doc: apidoc.Doc{
        Title: "Get user",
        Params: []apidoc.Param{
            {Name: "id", In: "path",
             Type: "int", Required: true},
        },
        Responses: []apidoc.Response{
            {Name: "name", Type: "string"},
        },
    },
})
user.rs
#[apidoc::title("Get user")]
#[apidoc::method("GET")]
#[apidoc::url("/users/{id}")]
#[apidoc::route_param(
    name = "id", ty = "int", required
)]
#[apidoc::returned(
    name = "name", ty = "string"
)]
async fn get_user() {}

One documentation experience, native in each.

Live debug, auth, exports and the shared UI follow one workflow; see each guide for exact capabilities.

Live debugging

Call real endpoints from the docs page with global params, Mock prefill and request/response events. Every language guide includes a debug panel.

200 OKsample response
{ "code": 0, "data": { "id": 1024 } }

Mock data

Field-level Mock examples. PHP supports rule expressions, Go generates values by type, and Rust ships 15 fake rules.

nickname"erik"
email"fake:email"
id1024

Apps and versions

Manage multiple apps and versions in one portal, switch by the app tree, and scope access passwords per app.

api v1admin v2open v3

Auth and caching

Global and per-app passwords, document caching, ETag/304 and constant-time comparison for speed with a security boundary.

password******

Unified exports

JSON, TypeScript, Markdown and Swagger/OpenAPI are available per language. Hand request and response shapes to front-end and QA.

JSONTypeScriptMarkdownSwagger

Code generation

PHP and Rust provide template-driven code generation; Go focuses on exports and comment parsing.

API fileHandlerSQL

Shared docs UI

apidoc-ui serves PHP, Go and Rust backends. Vue 3 + TypeScript with a fully static build.

apidoc-ui · Vue 3

Security boundary

HMAC tokens, CORS allowlists and path/identifier validation. Treat the docs server like a production API.

HMAC-SHA256CORS

From declaration to delivery

Declare, browse, debug, export and deploy on one path, shared by all three languages.

DeclareBrowseDebugExportDeploy
Declare

annotations next to code

Browse

docs generated automatically

Debug

live requests and Mock

Export

JSON / TS / Swagger

The usage guides are the core of this site.

Each guide covers installation, rules, complete examples, common scenarios and troubleshooting. Pick your stack, then go deep.

PHPv1.0.6

PHP Guide

Write PHP 8 attributes in Laravel, ThinkPHP, Hyperf, Webman, Yii2 or Yii3 and get a browsable, debuggable, exportable API portal.

  • Install and framework setup
  • Annotations, params and responses
  • definitions / ref / children reuse
  • Auth, exports, scenarios and troubleshooting
Read the guide
Gov1.0.7

Go Guide

Declare docs as typed structs next to route registration. A built-in web UI provides browsing and live debugging for net/http, Gin, Echo, Chi, Fiber, beego, Kratos and go-zero.

  • Install, Config and Router
  • Route / Doc / Param / Response
  • 8 framework adapters
  • Auth, caching, exports, scenarios and troubleshooting
Read the guide
Rustv2.0.0

Rust Guide

Declare docs with proc macros on handlers, register them statically at compile time and aggregate at zero runtime cost. Works with axum and actix-web, with auth, Mock, exports, sharing and codegen built in.

  • Dependencies, macros and compile-time rules
  • axum / actix-web setup
  • Auth, Mock, apps and versions
  • Exports, codegen, scenarios and troubleshooting
Read the guide
UIVue 3.5

apidoc-ui Guide

A Vue 3 + TypeScript documentation front-end with apps/versions, live debugging, sharing, Swagger export, cache management and i18n. The build output is fully static.

  • Build and deploy
  • config.js runtime config
  • Multi-host / appKey / auth
  • Debug events, Mock extensions and troubleshooting
Read the guide

16 framework adapters across mainstream servers.

6 for PHP, 8 for Go and 2 for Rust. One document model, thin native adapters.

PHP

6
LaravelThinkPHPHyperfWebmanYii2Yii3

Go

8
net/httpGinEchoChiFiberbeegoKratosgo-zero

Rust

2
axumactix-web

Pick a language and start.

The minimum install command for each stack. Framework setup, config and complete examples live in the guides.

PHPv1.0.6

PHP Guide

composer require erikwang2013/apidoc-php
Read the guide
Gov1.0.7

Go Guide

go get github.com/erikwang2013/apidoc-go
Read the guide

Every guide starts from a minimal runnable example, then covers annotation rules, scenarios and troubleshooting.

Current versions

Full changelogs and release assets live on each repository's Releases page.

PHPv1.0.6

Security and stability

  • Removed eval from templates/generators, added identifier allowlists and path checks
  • Fixed share lists, multi-level app trees and multi-annotation TypeError
  • Atomic cache writes, constant-time auth and smoke tests
View Releases
Gov1.0.7

Adapter docs and UI assets

  • Documented beego, Kratos and go-zero adapters
  • Bundled UI favicon and sidebar mascot
  • HTTP caching, reflect params and UI tree
View Releases
Rustv2.0.0

Native Rust auth

  • Auth rewritten in native Rust with POST + HMAC-SHA256
  • Removed the PHP-era implementation
  • Keeps all five v2 features: tables, cache, sharing, codegen, debug events
View Releases

The project pet, twelve moods.

It is a walking documentation page. Every expression is a standalone SVG with its own motion, honoring prefers-reduced-motion.

Apidoc pet: Smile
Smile:emoji-smile:
Apidoc pet: Joy
Joy:emoji-joy:
Apidoc pet: Cry
Cry:emoji-cry:
Apidoc pet: Depressed
Depressed:emoji-depressed:
Apidoc pet: Terrified
Terrified:emoji-terrified:
Apidoc pet: Angry
Angry:emoji-angry:
Apidoc pet: Coquettish
Coquettish:emoji-coquettish:
Apidoc pet: Cute
Cute:emoji-cute:
Apidoc pet: Pleasing
Pleasing:emoji-pleasing:
Apidoc pet: Knocking
Knocking:emoji-knocking:
Apidoc pet: Facepalm
Facepalm:emoji-facepalm:
Apidoc pet: Tongue
Tongue:emoji-tongue:

The project pet and expressions are visual assets owned by the author. Commercial use requires permission. See ASSETS-LICENSE.md. ASSETS-LICENSE.md.

Bring Apidoc to
your stack.

Get it from Packagist, Go modules, crates.io or GitHub. All three backends share one documentation UI.