How does the Kernel work?
The Domain-System is initialized via bootstrap.php. At this moment, the Dependency Injection Container is assembled. The Container is the brain that manages the creation of all important classes, ensuring no one creates objects the wrong way with "new" scattered throughout the code.
Core Components
- SessionManager: The single authority over user memory storage (prevents loose superglobals like $_SESSION across the code).
- Router (Gatekeeper): Maps URLs to Controllers and acts as a Bouncer (ACL), validating Privileges (Capabilities) via IdentityManager even before instantiating controllers.
- EventDispatcher (Triggers): Manages Actions (Hooks) and Filters. If a plugin wants to change the menu, it "listens" to the
admin.menuevent. - PluginManager: Reads the
src/SystemApps/andsrc/Plugins/folders, validatesplugin.json, and calls theregister()method of each active plugin. - ThemeManager: Manages the Front-end. Intercepts requests that are not from the API or Dashboard, and delivers visuals using Server-Side Rendering (SSR).
Request Flow (Life-cycle)
1. User accesses the browser. 2. public/index.php receives the request. 3. bootstrap.php loads the Container and Services (Database, EventDispatcher, SessionManager). 4. PluginManager activates the Plugins (each plugin injects its Routes and Repositories). 5. Router evaluates the URL and checks Access Rules (ACL). 6. Specific Controller is instantiated via Dependency Injection. 7. The Controller accesses the Repository Layer (Repository Pattern) which handles the DB via PDO. 8. A purely HTTP Response is returned to the user.