WP SSR Framework ships two completely independent routers: a Web Router that intercepts every front-end request before WordPress ever renders a template, and an API Router built on top of the WP REST API that exposes a cleanDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Ahondev/portfolio-v2/llms.txt
Use this file to discover all available pages before exploring further.
/api/v1/ namespace. Both are configured in plain PHP files you edit directly — no admin UI, no database rows, no rewrite-rule archaeology.
- Web Routes
- API Routes
Web Router
The Web Router owns every non-WordPress URL. On every requestWebRouter::handleRequest() runs early in the WordPress boot cycle and either serves a response or returns false to fall through to normal WordPress processing.Routes are registered in configuration/routes/web.php using the WebRoute facade (aliased as Route inside that file).Static routes
WebRoute::get() signature:| Parameter | Type | Description |
|---|---|---|
$path | string | Absolute URL path, e.g. /contact |
$name | string | Human-readable page title used for WP registration |
$controller | array | Two-element array: [ControllerClass::class, 'method'] |
WebRoute::post() signature:| Parameter | Type | Description |
|---|---|---|
$path | string | Absolute URL path, e.g. /submit |
$controller | string | Controller class name |
$name | string | Human-readable route name |
$auth | bool | When true, requires an active WordPress session |
WebRouteDefinition object, which stores the HTTP method, path, controller class, and action name.CPT routes
Route::CPT() is a convenience helper that binds an archive and a single route for a Custom Post Type in one call. The path serves as the base URL prefix.| Parameter | Type | Description |
|---|---|---|
$path | string | Base URL prefix, e.g. /blog |
$postType | string | EloquentCPT class that exposes a $model static property |
$controller | string | Controller class implementing CPTControllerInterface |
GET /blog→ callsBlogController::archive()GET /blog/my-article-slug→ looks up the post by slug, then callsBlogController::single(?EloquentCPT $post)
Route groups
UseRoute::group() to apply a shared prefix to several routes at once:Dispatch flow
WebRouter::handleRequest() executes the following logic on every inbound request:Skip WordPress-owned paths
Requests starting with
/wp/, /api/, /uploads/, /admin, or /client are ignored immediately — WordPress handles them normally.Bot detection & static cache
BotDetector::isBot() inspects the User-Agent. If a bot is detected, the router looks for a pre-generated HTML file under cache/client/static/{slug}.html. When found, it streams the file with X-SSG-Cache: HIT and exits. The ?json=1 query param bypasses the cache even for bots.Static route lookup
The current URI is matched against the
$routes hash map. If an exact match is found the corresponding controller method is called and its output echoed.CPT route matching
Each registered CPT base path is checked. An exact match dispatches to
archive(); a path that starts with the base followed by a slug segment dispatches to single() after fetching the matching WP_Post by slug.Dev-mode auto page registration
WhenWP_ENV=development, every call to addRoute() also calls registerPage() internally. This inserts a WordPress Page post whose slug mirrors the route path, so that ACF field groups scoped to post_type = page are always available for the route in the WordPress admin — without you having to create pages by hand.