Skip to content

Writing Documentation

The PAM documentation is part of the product. A feature is not finished until someone can learn it here: what problem it solves, a working example, its limits, and how to diagnose it when it fails. Fixing a typo, clarifying a confusing paragraph, or adding a missing example are all valuable contributions.

The site lives in push-in/pam-docs and is built with Astro and Starlight.

Every page has a link to edit it on GitHub. For a small correction, edit the file in the browser and open a pull request. For anything larger, work locally.

You need Node.js 22.12 or newer.

Terminal window
git clone https://github.com/push-in/pam-docs.git
cd pam-docs
npm ci
npm run dev

npm run dev serves the site with live reload, usually at http://localhost:4321.

src/
├─ content/docs/ Pages, one .mdx file per page
│ ├─ getting-started/
│ ├─ runtime/
│ ├─ basics/
│ ├─ operations/
│ ├─ reference/
│ ├─ laravel/ native/ desktop/ packages/
│ └─ community/ project/
├─ sidebar/ Sidebar groups, one file per section
└─ redirects/ Old slug → new path, one file per section

A page’s slug is its path: src/content/docs/basics/routing.mdx is published at /basics/routing/.

  1. Create the .mdx file with a short Title Case title and a one-sentence description:

    src/content/docs/runtime/example.mdx
    ---
    title: Example Feature
    description: One sentence that says what this page helps you do.
    ---
    ## Introduction
    What it is, and why you would use it.
  2. Add the page to the right group in src/sidebar/<section>.mjs. Each section owns its own file; edit only yours.

  3. If you move or rename a page, keep the old URL working by adding a redirect to src/redirects/<section>.mjs:

    src/redirects/core.mjs
    export default {
    '/runtime/old-name': '/runtime/new-name/',
    };
  4. Build the site and run the checks (below).

The full rules are in DOCS-STYLE.md at the repository root. The essentials:

  • Voice. English, second person (“you”), friendly and direct. No marketing language.
  • Structure. Start every page with an Introduction. Use ## for main sections and ### for subsections, and keep sections short.
  • Examples. Teach by example. Every concept gets a small, complete example that works when pasted. Put the file path in the code block title, as in ```php title="routes.php".
  • Asides. Use :::tip, :::note, :::caution, and :::danger sparingly.
  • Alternatives. Use <Tabs> and <TabItem> from @astrojs/starlight/components to show alternatives side by side, such as Linux and macOS.
  • Links. Link generously to related pages with absolute paths such as /runtime/async-io/, and end long pages with a short “Next Steps” list.
  • Neutral names. Use example.com, Alice, and Acme in examples.

Examples must use the PAM CLI the way users run it. An automated check enforces two rules:

  • Run Composer through PAM: write pam composer require vendor/package, never a bare composer require.
  • Do not pass the current directory as a trailing dot argument: write pam dev and let PAM use the current project implicitly.

PAM Native templates use p-* directives; legacy v-* directives are rejected.

MDX treats {, }, and < in prose as code. Wrap them in backticks (`{id}`) or escape them (\{). Inside fenced code blocks they are safe.

Accuracy is not negotiable:

  • Never invent an API, CLI flag, configuration key, default, or number. Check it against the source: the runtime in push-in/pam (src/, runtime/, packages/), or the package’s own repository. When the code and older documentation disagree, the code wins.
  • Run your examples. pam help <command> shows every flag a command accepts, and a scratch directory under /tmp is a good place to try them.
  • Say plainly when something is experimental or limited.
  • Publish the benchmark protocol and raw evidence next to any performance number. Only use numbers from the checked-in benchmarks.

Run these before you open a pull request:

Terminal window
node scripts/check-pam-syntax.mjs
SITE_URL=https://pamphp.com npx astro build
node scripts/check-links.mjs

The first validates command conventions, the build compiles every page, and the link check resolves every internal link in the built site.

npm run validate runs the complete suite used in CI, including type checks, accessibility (one main landmark and heading, skip links, image dimensions, zoom, focus outlines), and SEO checks:

Terminal window
npm run validate

A scheduled job also runs npm run check:freshness, which compares the docs with the latest public PAM release and opens an issue when the release page or the installation guide falls behind.

When PAM ships a release, the documentation needs:

  1. the Release Notes and, for behaviour changes, the Upgrade Guide;
  2. the installation page updated for the new version;
  3. new commands and configuration documented in the CLI Reference and Configuration Reference;
  4. support matrices updated on Project Status;
  5. links to the reproducible tests, benchmarks, and artifacts behind any claim.

Documentation-only corrections can ship at any time. Behaviour changes should land with, or right after, the runtime release that introduces them, and the pull request should cite the source commit or release that proves the change.