Building a docs module
A module is a folder with a manifest in it. Drop the folder into
SepoEngine/App/Modules/, and on the next request the engine discovers it,
creates the pages it declares, loads its routes, and renders its partial. There
is no registration step and no core file to edit.
By the end of this guide you will be able to ship a module that:
- renders an aggregate index — a searchable, paginated grid of items,
- renders a single item page as a custom server-rendered shell,
- declares several index pages, each with its own front-matter key,
- persists data through a store, with a JSON file as the source of truth,
- accepts writes through a real
POSTroute, because the docs mount is read-only, - shows manager-only views to editors and admins.
Throughout, we build one concrete example — a Polls module — so every step has real code you can adapt.
This supersedes the legacy approach. Modules are no longer
included by hand fromDocs.php, and stores are no longer threaded through the layout closure'suse(...)list. If you find a guide describing either, it predatesModuleManagerand does not apply.
1. How it fits together
SepoEngine/App/Modules/
│
▼
ModuleManager::discover() ← globs for FOLDERS, reads each Manifest.php
│ sorts by priority, caches for the request
│
├─ autoInstall() → ModuleInstaller writes any missing index pages
├─ registerServices() → manifest `services` into the container
└─ loadRoutes() → requires each module's Routes.php
│
▼
App/Views/Layouts/Docs.php ← the shell
│ prepares $e, $icon, $withBase, $apiBase, $canEdit, $store, …
│
├─ ModuleManager::partials(false) content modules, priority < 100
│ include <module>/Partial.php ← YOUR MODULE
│
├─ legacy content partials
│
└─ ModuleManager::partials(true) gates, priority >= 100
│
▼ each partial inspects $meta + $file, decides whether the page is its
own, and either APPENDS to or REPLACES $content
Writes take a different door:
Client JS ──fetch──▶ POST /api/v2/polls/vote (your Routes.php)
│ AuthMiddleware
▼
Your Store → Content/Polls/…json (truth)
└─ optional DB mirror (SQLite)
Four things to internalise before writing any code:
- A module is a folder. Discovery uses
glob(..., GLOB_ONLYDIR). Loose files dropped straight intoApp/Modules/are invisible. - The partial only renders. It never writes. It reads the current page's front matter and produces HTML.
- The docs mount is GET-only. Any state change is a
fetch()to a separate/api/v2/...route. - The partial runs before
<head>is written. Anything it echoes during the prep phase lands above the document head. Assign to$content.
2. Folder structure and file names
SepoEngine/App/Modules/Polls/
├── Manifest.php REQUIRED — the only file the engine looks for by name
├── Partial.php the renderer, named by the manifest's `partial` key
├── Routes.php POST endpoints, named by the manifest's `routes` key
├── Lib.php shared helpers, required by both the above
├── Views/
│ ├── PollIndex.php the aggregate grid
│ └── PollDetail.php the single-item shell
└── Store/
└── PollStore.php persistence
Only Manifest.php has a fixed name. Everything else is named by the manifest,
so partial => 'Render.php' works if you prefer.
Casing rules
Manifest.php and manifest.php are both accepted, in that order — Linux is
case-sensitive and Windows is not, and a single hardcoded spelling is the classic
works-locally-fails-in-production bug. Every other file follows whatever you
wrote in the manifest, so match the real casing exactly.
The folder name becomes the module id, and it must match
^[A-Za-z][A-Za-z0-9_-]{0,63}$ — it is used as a directory name and as a
sidebar exclusion key.
Namespace
SepoEngine\App\Modules\<FolderName>\…, mirroring the path:
namespace SepoEngine\App\Modules\Polls\Store;
final class PollStore { … }
3. The manifest
Manifest.php returns an array. Nothing is constructed here — a manifest is
evaluated on every request, including on pages that will never use the module.
<?php
declare(strict_types=1);
use SepoEngine\Core\PathHelper;
return [
'name' => 'Polls',
'partial' => 'Partial.php',
'routes' => ['Routes.php'],
'priority' => 35,
'excludeFromSidebar' => true,
'store' => [
'class' => \SepoEngine\App\Modules\Polls\Store\PollStore::class,
'args' => [
PathHelper::basePath('Content/Polls'), // $root
'polls_votes', // $dir
null, // $pdo — see §5.3
],
],
'detect' => [
'index' => 'polls_dir', // front-matter key marking the index
'directory' => 'polls', // folder holding poll pages
],
'indexPage' => [
'slug' => 'polls',
'title' => 'Polls',
'description' => 'Cast your vote on important topics.',
'order' => 60,
'aggregates' => 'polls',
],
'sidebar' => [
'label' => 'Polls',
'icon' => '',
],
'services' => [],
];
Every key
| Key | Type | Default | What it does |
|---|---|---|---|
name | string | ucfirst(id) | Display name, diagnostics only |
partial | string | Partial.php | File the docs shell includes |
routes | array | [] | Files required at route-load time |
priority | int | 50 | Include order. < 100 content, ≥ 100 gate |
excludeFromSidebar | bool | false | Feeds exclusionList() |
store | array | null | See §5 |
services | array | [] | Container registrations, see §5.4 |
detect.index | string | — | Front-matter key marking the index page |
detect.directory | string | — | Primary content folder, hidden from the sidebar |
detect.directories | array | [] | Further folders to hide |
indexPage | array | null | The primary page the installer creates |
indexPages | array | [] | Further pages, see §4.2 |
sidebar.label / .icon | string | — | Sidebar presentation |
Priority and the gate boundary
Anything below 100 is a content module — it builds $content. Anything at
100 or above is a gate, and gates run after every content partial because
they replace $content wholesale (the membership upsell can only gate content
that already exists).
Within each band, lower runs first. Existing values: Master 5, Maintainers and Shop 20, LMS 25, Bookings 30, Forms/Podcast/Polls/Resources 35, Dictionary/MemberResources 40, Apidocs/ModuleUploader/Releases 45.
4. Index pages
ModuleInstaller writes a module's index pages into Content/Pages/ on the
first request after the module appears. It never overwrites — a page edited
by hand survives every subsequent run — and it only stats files that already
exist, so the steady-state cost is one is_file() per declared page.
4.1 The primary page
'detect' => [
'index' => 'polls_dir',
],
'indexPage' => [
'slug' => 'polls', // → Content/Pages/polls.md
'title' => 'Polls',
'description' => 'Cast your vote on important topics.',
'order' => 60,
'aggregates' => 'polls', // the VALUE written for the key above
],
produces:
---
title: Polls
description: Cast your vote on important topics.
order: 60
polls_dir: polls
---
# Polls
Cast your vote on important topics.
The primary page inherits its front-matter key from detect.index. That is the
only page that does.
4.2 Further index pages
A module that dispatches on more than one front-matter key needs one entry per key. LMS owns five pages; Shop owns five; Bookings owns four.
'indexPages' => [
[
'slug' => 'schools',
'title' => 'Schools',
'description' => 'Institutions running courses on this site.',
'order' => 31,
'field' => 'schools_dir', // REQUIRED on further pages
'aggregates' => 'schools',
'directory' => 'schools', // also hidden from the sidebar
],
[
'slug' => 'admin/my-courses',
'title' => 'My Courses',
'order' => 33,
'field' => 'my_courses',
'aggregates' => 'true', // a boolean flag page
],
],
field is mandatory here. A further page without one is skipped with a warning,
because defaulting it to detect.index would give two pages the same aggregate
marker and the sidebar would hide the wrong one.
4.3 Extra front matter
If your partial gates on a key the installer would not otherwise write, use
front:
'indexPage' => [
'slug' => 'dictionary',
'title' => 'Dictionary',
'order' => 57,
'aggregates' => 'dictionary',
'front' => [
'dictionary' => 'true',
'word_of_day' => 'true',
'allow_submissions' => 'false',
],
],
A key placed loose in indexPage is silently ignored. The installer reads
slug, title, description, order, aggregates, field, dir,
directory, hideFromSidebar and front — nothing else. Writing
'dictionary' => 'true' at the top level was a real bug in this codebase: the
page was created without the flag, and the partial returned on its first line.
4.4 Where standalone pages go
A page carrying a *_dir key can sit at the content root — the sidebar hides it
by matching the aggregate value against the exclusion list.
A page carrying only a boolean flag has nothing to match on, so it must live
inside an excluded folder. By convention that is admin/, listed in
detect.directories.
5. Stores
5.1 Two ways to declare one
Constructed — the module owns the class:
'store' => [
'class' => \SepoEngine\App\Modules\Polls\Store\PollStore::class,
'args' => [PathHelper::basePath('Content/Polls'), 'polls_votes', null],
],
Container lookup — the store is registered elsewhere:
'store' => [
'service' => \SepoEngine\Core\MembershipStore::class,
],
Prefer service whenever the store is already registered. With class, the
manifest builds a second instance, and code resolving it through
$router->getService() gets a different object — or throws, because nothing
registered it. One registration, one instance, both paths work.
args is positional. String keys are spread as PHP named arguments and would
have to match the constructor's parameter names exactly.
5.2 Stores are lazy
ModuleManager::getStore() builds on first call and caches for the request. Call
it inside your handler or after your partial's early-return guards, never
at include time — a docs page that renders no module UI should open no
connection.
The closure is injected for you:
$pollStore = null;
if (isset($moduleStore) && is_callable($moduleStore)) {
try {
$resolved = $moduleStore();
if (is_object($resolved)) {
$pollStore = $resolved;
}
} catch (Throwable $ex) { // $ex, never $e — see §8.2
error_log('[polls] store failed to resolve: ' . $ex->getMessage());
}
}
5.3 Pass null for the PDO slot
Stores here use StoreDbTrait with the STORES_DB handle, which is SQLite and
opened by the trait itself.
'args' => [
PathHelper::basePath('Content/Polls'),
'polls_votes',
null, // $pdo — StoreDbTrait opens STORES_DB (SQLite) itself
],
5.4 Services
registerServices() accepts exactly two shapes:
'services' => [
// a class-string, constructed with NO arguments
FooStore::class => FooStore::class,
// a Closure, for anything that needs constructor arguments
BarStore::class => static fn() => new BarStore(
PathHelper::basePath('Content/Bar'),
null
),
],
An ['class' => …, 'args' => …] array is not one of them — it logs
"Unusable module service definition" and the service is silently skipped.
5.5 Writing the store itself
File is truth, DB is a best-effort mirror. Three things are non-negotiable:
Sanitise the slug before it touches the filesystem.
private function pathFor(string $slug): string
{
$key = basename(str_replace('\\', '/', trim($slug)));
if (str_ends_with(strtolower($key), '.md')) {
$key = substr($key, 0, -3);
}
if ($key === '' || str_contains($key, '..')
|| str_contains($key, '/') || str_contains($key, '\\')) {
throw new \InvalidArgumentException('Invalid reference.');
}
return $this->data . '/' . $key . '.json';
}
Write atomically. Temp file, then rename() — a crash must never leave a
half-written JSON that parses as an empty array.
private function writeJson(string $file, array $rows): void
{
$json = json_encode(array_values($rows),
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
if ($json === false) {
throw new \RuntimeException('Failed to encode data.');
}
$tmp = $file . '.tmp';
if (@file_put_contents($tmp, $json, LOCK_EX) === false) {
throw new \RuntimeException('Failed to write data.');
}
@rename($tmp, $file);
}
Never let the mirror throw. The file already succeeded by the time the mirror
runs, so a mirror failure is a log line, not an error. StoreDbTrait handles
this — use it rather than hand-rolling.
6. The partial
6.1 What is in scope
The partial runs in the docs shell's own scope, so every variable the shell and every earlier partial defined is visible.
| Variable | Type | What it is |
|---|---|---|
$store | FilePageStore | The page store. listFiles(), pathFor(), splitFrontMatter() |
$router | Router or null | fileUrl($slug, $mountName) builds a page URL |
$file | array | Current page row; $file['slug'] is the slug |
$meta | array | Parsed front matter |
$content | string | Rendered page HTML — mutate this |
$moduleStore | callable | Your store, resolved lazily |
$moduleId | string | Your folder name |
$e | callable | HTML escaper |
$icon | callable | $icon('name', 18) → inline SVG |
$assetUrl / $linkUrl / $withBase | callable | URL builders |
$mountPrefix / $mountName | string | Docs mount |
$apiBase | string | Ends in /pages; strip that to reach /api/v2 |
$csrfToken / $csrfHeader | string | For your fetch calls |
$canEdit | bool | Docs-admin — your "is manager" seed |
6.2 The five rules
- Detect, then return early. If the page is neither your index nor one of
your items,
return;and leave$contentuntouched. - Never echo. The partial runs before
<!DOCTYPE html>. Buffer withob_start()/ob_get_clean()and assign to$content. - Append for an index, replace for an item. An index keeps its authored
markdown and appends below it (
$content .= …). An item page is a full custom shell ($content = …). - Prefix every local. Partials share one scope.
$slug,$row,$frontand$eare all already taken. Use a short unique prefix —pl_,$plRow. - Guard every helper with
function_exists, and define it before the code that calls it (see §8.1).
6.3 Skeleton
<?php
declare(strict_types=1);
use SepoEngine\Core\FilePageStore;
$store = $store ?? null;
$meta = $meta ?? [];
$file = $file ?? [];
$content = $content ?? '';
if (!($store instanceof FilePageStore)) {
return;
}
// ---- context detection — before any work, so unrelated pages cost nothing --
$plSlug = str_replace('\\', '/', (string)($file['slug'] ?? ''));
$plDir = str_contains($plSlug, '/')
? substr($plSlug, 0, (int)strrpos($plSlug, '/'))
: '';
$plIndexDir = trim((string)($meta['polls_dir'] ?? ''));
$plIsItem = ((bool)($meta['poll'] ?? false))
|| $plDir === 'polls'
|| str_ends_with($plDir, '/polls');
$plIsIndex = ($plIndexDir !== '' && !$plIsItem);
if (!$plIsIndex && !$plIsItem) {
return; // not our page
}
// ---- path traversal guard on an item page --------------------------------
if ($plIsItem) {
foreach (explode('/', $plSlug) as $plSeg) {
if ($plSeg === '..' || $plSeg === '.') {
return;
}
}
}
require_once __DIR__ . '/Lib.php';
// ---- scope guards ---------------------------------------------------------
$plE = (isset($e) && is_callable($e))
? $e
: static fn($v): string => htmlspecialchars((string)$v, ENT_QUOTES | ENT_HTML5, 'UTF-8');
// ---- store — after the guards, so no connection on unrelated pages --------
$plStore = null;
if (isset($moduleStore) && is_callable($moduleStore)) {
try {
$plResolved = $moduleStore();
if (is_object($plResolved)) {
$plStore = $plResolved;
}
} catch (Throwable $ex) {
error_log('[polls] store failed to resolve: ' . $ex->getMessage());
}
}
// ---- dispatch -------------------------------------------------------------
$plView = __DIR__ . '/Views/' . ($plIsIndex ? 'PollIndex.php' : 'PollDetail.php');
if (!is_file($plView)) {
\SepoEngine\Helpers\Logger::warning('Polls view missing', ['path' => $plView]);
return;
}
// Buffer even though the views assign $content themselves: a stray echo would
// otherwise land above <head>.
ob_start();
require $plView;
$plEchoed = (string)ob_get_clean();
if (trim($plEchoed) !== '') {
$content = $plEchoed;
}
7. Routes
Routes.php is required into the global namespace by
ModuleManager::loadRoutes(), so import every class you use — the main routes
file's imports are not visible from inside a module.
In scope: $router, $moduleId, $module (the manifest), $moduleStore.
<?php
use SepoEngine\App\Middlewares\SessionSecurity;
use SepoEngine\Helpers\Logger;
$router->post('/api/v2/polls/vote', static function (
\SepoEngine\Core\Request $request,
\SepoEngine\Core\Response $response
) use ($moduleStore): void {
$store = $moduleStore(); // resolved here, not at file load
if (!is_object($store)) {
$response->json(['status' => 'error', 'message' => 'Polls are unavailable.'], 503);
return;
}
$slug = trim((string)($request->getBodyParam('poll') ?? ''));
$option = (int)($request->getBodyParam('option') ?? -1);
$uid = (string)($_SESSION['user_id'] ?? '');
if ($slug === '' || $option < 0) {
$response->json(['status' => 'error', 'message' => 'Missing poll reference.'], 422);
return;
}
try {
$store->vote($slug, $option, $uid);
} catch (\InvalidArgumentException $e) {
$response->json(['status' => 'error', 'message' => $e->getMessage()], 422);
return;
} catch (\Throwable $e) {
Logger::exception($e, ['module' => 'Polls', 'stage' => 'vote']);
$response->json(['status' => 'error', 'message' => 'Could not record your vote.'], 500);
return;
}
$response->json(['status' => 'success', 'data' => $store->getStats($slug)]);
}, ['middlewares' => ['AuthMiddleware']]);
Admin routes
Gate in the middleware list and inline. Deploys are file-by-file and middleware lists get edited; the inline check is the fail-closed backstop.
$router->post('/api/v2/polls/admin/close', static function ($request, $response): void {
if (!SessionSecurity::isDocsAdmin()) {
$response->json(['status' => 'error', 'message' => 'Admin access required.'], 403);
return;
}
// …
}, ['middlewares' => ['AuthMiddleware', SessionSecurity::docsAdminGate()]]);
isDocsAdmin() is the docs-editing permission. isAdmin() is a full
administrator — use it for anything that writes code or changes system state.
8. Traps
Every one of these has cost a debugging session in this codebase.
8.1 Conditional function declarations are not hoisted
$html = pl_render(); // Fatal: undefined function
if (!function_exists('pl_render')) {
function pl_render(): string { … }
}
PHP hoists only unconditional top-level function declarations. A declaration
inside an if does not exist until execution reaches that line. Put every
guarded helper block above its first call site, or in Lib.php.
This is worse when the call is inside a try: the Error is caught by your own
handler and the page renders "Something went wrong" instead of a stack trace.
8.2 catch (Throwable $e) destroys the escaper
$e is the docs layout's escaping closure. PHP keeps a catch variable in scope
after the block, so this replaces it with an exception object and every later
$e(...) call in the request fatals with "Object of type RuntimeException is not
callable".
Always name your catch variable something else — $ex, $plErr.
8.3 Echoing during the prep phase
The partial runs before <head> is written. The first byte it prints
force-closes the document head, and every <meta>, stylesheet and the pre-paint
theme script land inside <body> — the page renders with its navigation on top
of the content.
Docs.php buffers the whole prep phase now, so a stray echo is discarded rather
than fatal, but your markup silently disappears. Assign to $content.
8.4 Do not initialise a store to null when a view uses isset()
isset($store) on a variable holding null is false. If a view guards with
isset(), pre-initialising to null makes it render nothing instead of showing
an error. Either unset() first and only assign on success, or have the view
check is_object().
8.5 Scope the view-toggle lookup
var toggle = document.querySelector(".component-view-toggle"); // wrong
That finds whichever toolbar rendered first, which may belong to another module sharing the page. Scope it to your own container:
var panel = container.closest(".pl-index-wrap") || document;
var toggle = panel.querySelector(".component-view-toggle");
ViewToggle reads gridClass and listClass. gridView/listView are
silently ignored.
8.6 Build inline JS with json_encode, never by hand
$js = 'var VERSION = "' . MODULE_VERSION . '";'; // fragile
$js = 'var VERSION = ' . json_encode(MODULE_VERSION) . ';'; // correct
A stray PHP concatenation dot inside a single-quoted JS string emits literally
and is a hard SyntaxError — the browser discards the entire <script> and every
feature in it dies silently. Pass icons, ids and counts through json_encode or
an (int) cast so nothing in the script body is hand-quoted.
8.7 Windows path separators
FilePageStore slug fields carry backslashes on Windows. Normalise with
str_replace('\\', '/', $slug) before matching, or compare on the directory
field instead.
8.8 const in an included file
A bare const at the top of a partial is a fatal on a second include. Use
if (!defined('X')) { define('X', …); }.
9. Front matter contract
The index page
---
title: Community Polls
polls_dir: polls
---
Vote on what we build next.
The partial keeps this body and appends the grid below it.
A single item page
Lives under Content/Pages/polls/, or any page setting poll: true:
---
title: Which feature next?
poll: true
requireLogin: true
options: Dark mode | Offline sync | Public API | Mobile app
closed: false
---
Pick one — results show after you vote.
Front matter cannot nest, so list values are pipe-delimited within an entry and comma-separated between entries:
sponsors: [Acme|https://acme.test|/img/acme.svg, Globex|https://globex.test]
Authoring gotcha. The Markdown renderer treats
|as a table-cell delimiter and breaks on a literal pipe inside a cell, even in inline code. When documenting a pipe-separated value, use a fenced code block — never a table cell.
10. Client-side conventions
Everything the client needs is on window.SepoDocsConfig: api (ends in
/pages), csrf, csrfHeader, mount, slug, canEdit, assetVersion.
function endpoint(path) {
var cfg = window.SepoDocsConfig || {};
return (cfg.api || "").replace(/\/pages\/?$/, "") + path;
}
function post(path, payload) {
var cfg = window.SepoDocsConfig || {};
var headers = {
"Content-Type": "application/json",
Accept: "application/json",
"X-Requested-With": "XMLHttpRequest",
};
if (cfg.csrf) {
headers[cfg.csrfHeader || "X-CSRF-Token"] = cfg.csrf;
payload._token = cfg.csrf;
payload.csrf_token = cfg.csrf;
}
return fetch(endpoint(path), {
method: "POST",
credentials: "same-origin",
headers: headers,
body: JSON.stringify(payload),
}).then(function (r) {
return r.text().then(function (txt) {
var b = {};
try {
b = JSON.parse(txt);
} catch (e) {
throw new Error("Unexpected response (" + r.status + ").");
}
if (!r.ok || b.status === "error") {
throw new Error(b.message || "Request failed (" + r.status + ")");
}
return b;
});
});
}
Hydrating an index
Server-render the cards with their data on data-* attributes, then let
window.Components re-render from those attributes. The list works with JS off
(all cards, unpaged) and gains search, paging and a grid/list toggle with it on.
The two templates — the PHP one and the JS one — must stay in step. Say so in a comment above each.
function initPolls() {
var container = document.querySelector("[data-pl-container]");
if (!container) return;
if (typeof window.Components === "undefined") {
setTimeout(initPolls, 200); // reusables bundle not parsed yet
return;
}
var cards = Array.prototype.slice.call(container.querySelectorAll(".pl-card"));
if (!cards.length) return;
var items = cards.map(function (card) {
return {
title: card.getAttribute("data-title") || "",
url: card.getAttribute("href") || "",
search: card.getAttribute("data-search") || "",
};
});
var renderer = new window.Components.GridRenderer({ … });
var pagination = new window.Components.Pagination({ … });
pagination.setTotalItems(items);
if (items.length > 0 && items.length <= PER_PAGE) renderer.render(items);
}
Always guard on window.Components and retry — the bundle may load after your
inline script.
11. Packaging and installing
A module can be installed by file transfer, or through the Module Uploader
at /docs/admin/modules when MODULE_UPLOAD_ENABLED=true.
Zip the module folder, not its contents:
cd SepoEngine/App/Modules
zip -r Polls.zip Polls
The archive must contain exactly one top-level folder with Manifest.php inside
it. Limits: 8 MB compressed, 32 MB uncompressed, 400 entries, and a file-type
whitelist (php md txt json yml yaml css js map svg png jpg jpeg gif webp ico
woff woff2 ttf html).
Replaced and removed modules are moved to Storage/Backups/modules, not deleted,
and can be restored from the uploader's Backups tab.
Installing a module is remote code execution as a feature. Only install packages you wrote or trust, and turn
MODULE_UPLOAD_ENABLEDoff again afterwards — while it is off the endpoints answer 404.
12. Verifying it worked
GET /api/v2/admin/modules/state returns what discovery currently sees:
"Polls": {
"manifest": "Manifest.php",
"priority": 35,
"partial_found": true,
"route_files": ["Routes.php"],
"index_pages": {
"polls": {
"path": "…/Content/Pages/polls.md",
"exists": true,
"front_field": "polls_dir",
"value": "polls",
"primary": true
}
},
"pages_declared": 1,
"pages_missing": 0,
"store": "class: …\\PollStore",
"store_resolves": true
}
What to check: partial_found and store_resolves are true,
pages_missing is 0, and front_field matches the key your partial guards on.
dir_entries at the top of the payload tells apart the three ways discovery
finds nothing — an empty folder, files uploaded loose instead of inside a folder,
or a manifest under an unexpected name.
Everything that fails is logged at warning or above, so it is visible in
Storage/Logs/sepo-<date>.log without turning on debug logging.
13. Ship checklist
- [ ] Folder name matches
^[A-Za-z][A-Za-z0-9_-]{0,63}$; namespace mirrors the path. - [ ]
Manifest.phppresent, correctly cased, returns an array. - [ ]
prioritybelow 100 for content, 100+ for a gate. - [ ]
detect.indexmatches the keyPartial.phpactually guards on. - [ ] Every dispatch key has an
indexPagesentry with its ownfield. - [ ] Flag-only pages live under
admin/and it is indetect.directories. - [ ] Every folder the partial accepts is in
detect.directoryor.directories. - [ ] Store args pass
nullfor the PDO slot, not'@pdo'. - [ ] Store resolved after the early-return guards, never at include time.
- [ ] Partial returns early on unrelated pages and never echoes.
- [ ] Helpers are
function_exists-guarded and defined above their call sites. - [ ] Catch variables are not
$e. - [ ] Locals are prefixed.
- [ ] Inline JS builds every injected value with
json_encodeor a cast. - [ ] View-toggle lookup scoped to the module's own container.
- [ ] POST routes under
/api/v2, CSRF honoured, admin checks inline and in the middleware list. - [ ]
php -lclean on every file. - [ ]
pages_missing: 0andstore_resolves: truein the diagnostics. - [ ] Tested signed-out, signed-in, and as a manager; tested with the store unavailable.