Skip to main content

Documentation 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.

The Kernel class is the single entry point that brings the entire WP SSR Framework to life. Call it once from your mu-plugin bootstrap file — it validates that ACF Pro is active, registers your service providers, and schedules every framework subsystem onto the correct WordPress action hook in deterministic priority order.

Requirements

Before any boot logic runs the Kernel constructor calls checkThemeRequirements(). It verifies that acf_add_options_page exists (i.e., ACF Pro is installed and active). If the check fails, the framework helper wp_exit() is called immediately — which wraps wp_die() with a formatted error message — preventing a broken site from loading silently.
ACF Pro is a hard dependency of the WP SSR Framework. The Kernel will halt via wp_die() if it is missing.

Static Factory

Kernel::configure(): Kernel
Use the static factory instead of new Kernel directly. This mirrors the fluent configuration style used throughout the framework and makes the bootstrap file easy to read at a glance.

Methods

withProviders()

providers
array
required
An array of fully-qualified service provider class names. Each class must extend BaseServiceProvider. Providers are instantiated and sorted by their $priority property before booting.
Kernel::configure()
    ->withProviders([
        AppServiceProvider::class,
        CacheServiceProvider::class,
    ])
    ->boot();
Returns self to allow method chaining directly into boot().

boot()

Seals the configuration and registers every framework subsystem onto WordPress action hooks. Returns the Kernel instance so you can keep a reference if needed (rarely necessary).
public function boot(): Kernel

Boot Order

The Kernel hooks subsystems in a carefully chosen order so that each layer is ready before the next depends on it.
HookPrioritySubsystem
init10EloquentManager — boot the CPT model registry
init20PostType::init() — register custom post types & taxonomies
rest_api_init30ApiRouter::init() — register REST routes under api/v1
after_setup_themeOption::init() — register ACF options pages
admin_init40WP_Options::register() — register WordPress option wrappers
wp_loaded1ComposerManager::registerComposers() — attach view composers
wp_loaded5WebRouter::init()->handleRequest() — handle the incoming web request
Service providers are registered synchronously before any hooks fire. Their register() methods run immediately; boot() methods are deferred to the init hook using the provider’s own $priority.

Full Bootstrap Example

This is the complete wp-ssr.php bootstrap file that ships with the framework. Copy it as a starting point for your own mu-plugin.
<?php
/**
 * Plugin Name: WP SSR Framework
 * Description: Headless CMS core for WordPress (SSR mode)
 */

use Ahon\WPCMS\Kernel;
use Roots\Acorn\Application;

require_once __DIR__ . '/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Boot Acorn
|--------------------------------------------------------------------------
*/

if (! class_exists(\Roots\Acorn\Application::class)) {
    wp_die(
        __('You need to install Acorn to use this site.', 'domain'),
        '',
        [
            'link_url'  => 'https://roots.io/acorn/docs/installation/',
            'link_text' => __('Acorn Docs: Installation', 'domain'),
        ]
    );
}

add_action('after_setup_theme', function () {
    Application::configure()
        ->withProviders([
            App\Providers\ThemeServiceProvider::class,
        ])
        ->boot();
}, 0);

/*
|--------------------------------------------------------------------------
| Bootstrap custom Kernel
|--------------------------------------------------------------------------
*/

Kernel::configure()
    ->withProviders([
        Ahon\WPCMS\App\Providers\AppServiceProvider::class,
        Ahon\WPCMS\App\Providers\RateLimitServiceProvider::class,
        Ahon\WPCMS\App\Providers\CacheServiceProvider::class,
        Ahon\WPCMS\App\Providers\AnalyticsServiceProvider::class,
        Ahon\WPCMS\App\Providers\SEOServiceProvider::class,
        Ahon\WPCMS\App\Providers\RoutingServiceProvider::class,
        Ahon\WPCMS\App\Providers\SSGServiceProvider::class,
    ])
    ->boot();

Class Reference

namespace Ahon\WPCMS;

class Kernel
{
    public array $providers = [];

    public static function configure(): Kernel;
    public function withProviders(array $providers): self;
    public function boot(): Kernel;

    private function checkThemeRequirements(): void;
}
You only ever call Kernel::configure()->withProviders([...])->boot() once. Calling it a second time will attempt to re-register all action hooks and may produce unexpected behaviour.

Build docs developers (and LLMs) love