2026-01-21 14:11:45 +00:00
|
|
|
<?php
|
2026-01-26 21:21:53 +00:00
|
|
|
|
2026-01-22 18:45:52 +00:00
|
|
|
/*
|
|
|
|
|
* Core PHP Framework
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the European Union Public Licence (EUPL) v1.2.
|
|
|
|
|
* See LICENSE file for details.
|
|
|
|
|
*/
|
2026-01-21 14:11:45 +00:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Core;
|
|
|
|
|
|
|
|
|
|
use Core\Events\AdminPanelBooting;
|
|
|
|
|
use Core\Events\ApiRoutesRegistering;
|
|
|
|
|
use Core\Events\ClientRoutesRegistering;
|
|
|
|
|
use Core\Events\ConsoleBooting;
|
|
|
|
|
use Core\Events\FrameworkBooted;
|
2026-03-03 21:52:55 +00:00
|
|
|
use Core\Events\McpRoutesRegistering;
|
2026-01-21 14:11:45 +00:00
|
|
|
use Core\Events\McpToolsRegistering;
|
|
|
|
|
use Core\Events\QueueWorkerBooting;
|
|
|
|
|
use Core\Events\WebRoutesRegistering;
|
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
use Livewire\Livewire;
|
|
|
|
|
|
|
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Orchestrates lifecycle events for lazy module loading.
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* The LifecycleEventProvider is the entry point for the event-driven module system.
|
|
|
|
|
* It coordinates module discovery, listener registration, and event firing at
|
|
|
|
|
* appropriate points during the application lifecycle.
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
2026-01-26 14:24:25 +00:00
|
|
|
* ## Lifecycle Event Firing Sequence
|
|
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
* ┌─────────────────────────────────────────────────────────────────────────────┐
|
|
|
|
|
* │ LIFECYCLE EVENT FIRING SEQUENCE │
|
|
|
|
|
* └─────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
*
|
|
|
|
|
* Application
|
|
|
|
|
* │
|
|
|
|
|
* ├─── register() ──────────────────────────────────────────────────────┐
|
|
|
|
|
* │ │ │
|
|
|
|
|
* │ ├── ModuleScanner::scan() │
|
|
|
|
|
* │ │ Discovers Boot.php files with $listens │
|
|
|
|
|
* │ │ │
|
|
|
|
|
* │ └── ModuleRegistry::register() │
|
|
|
|
|
* │ Wires LazyModuleListener for each event/module │
|
|
|
|
|
* │ │
|
|
|
|
|
* ├─── boot() ──────────────────────────────────────────────────────────┤
|
|
|
|
|
* │ │ │
|
|
|
|
|
* │ ├── (if queue.worker bound) │
|
|
|
|
|
* │ │ └── fireQueueWorkerBooting() │
|
|
|
|
|
* │ │ Fires: QueueWorkerBooting │
|
|
|
|
|
* │ │ │
|
|
|
|
|
* │ └── $app->booted() callback registered │
|
|
|
|
|
* │ └── Fires: FrameworkBooted │
|
|
|
|
|
* │ │
|
|
|
|
|
* │ │
|
|
|
|
|
* ┌───┴─────────────────────────────────────────────────────────────────────┤
|
|
|
|
|
* │ FRONTAGE MODULES FIRE CONTEXT-SPECIFIC EVENTS │
|
|
|
|
|
* └──────────────────────────────────────────────────────────────────────────┤
|
|
|
|
|
* │ │
|
|
|
|
|
* ├─── Front/Web/Boot ────────────────────────────────────────────────── │
|
|
|
|
|
* │ └── LifecycleEventProvider::fireWebRoutes() │
|
|
|
|
|
* │ Fires: WebRoutesRegistering │
|
|
|
|
|
* │ Processes: views, livewire, routes ('web' middleware)│
|
|
|
|
|
* │ │
|
|
|
|
|
* ├─── Front/Admin/Boot ──────────────────────────────────────────────── │
|
|
|
|
|
* │ └── LifecycleEventProvider::fireAdminBooting() │
|
|
|
|
|
* │ Fires: AdminPanelBooting │
|
|
|
|
|
* │ Processes: views, translations, livewire, routes │
|
|
|
|
|
* │ ('admin' middleware) │
|
|
|
|
|
* │ │
|
|
|
|
|
* ├─── Front/Api/Boot ────────────────────────────────────────────────── │
|
|
|
|
|
* │ └── LifecycleEventProvider::fireApiRoutes() │
|
|
|
|
|
* │ Fires: ApiRoutesRegistering │
|
2026-03-04 12:39:44 +00:00
|
|
|
* │ Processes: routes ('api' middleware) │
|
2026-01-26 14:24:25 +00:00
|
|
|
* │ │
|
|
|
|
|
* ├─── Front/Client/Boot ─────────────────────────────────────────────── │
|
|
|
|
|
* │ └── LifecycleEventProvider::fireClientRoutes() │
|
|
|
|
|
* │ Fires: ClientRoutesRegistering │
|
|
|
|
|
* │ Processes: views, livewire, routes ('client' mw) │
|
|
|
|
|
* │ │
|
|
|
|
|
* ├─── Front/Cli/Boot ────────────────────────────────────────────────── │
|
|
|
|
|
* │ └── LifecycleEventProvider::fireConsoleBooting() │
|
|
|
|
|
* │ Fires: ConsoleBooting │
|
|
|
|
|
* │ Processes: command classes │
|
|
|
|
|
* │ │
|
|
|
|
|
* └─── Front/Mcp/Boot ────────────────────────────────────────────────── │
|
2026-03-03 21:52:55 +00:00
|
|
|
* ├── LifecycleEventProvider::fireMcpRoutes() │
|
|
|
|
|
* │ Fires: McpRoutesRegistering │
|
|
|
|
|
* │ Processes: routes ('mcp' middleware) │
|
|
|
|
|
* │ │
|
2026-01-26 14:24:25 +00:00
|
|
|
* └── LifecycleEventProvider::fireMcpTools() │
|
|
|
|
|
* Fires: McpToolsRegistering │
|
|
|
|
|
* Returns: MCP tool handler classes │
|
|
|
|
|
* │
|
|
|
|
|
* └──────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
* ```
|
|
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* ## Lifecycle Phases
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* **Registration Phase (register())**
|
|
|
|
|
* - Registers ModuleScanner and ModuleRegistry as singletons
|
|
|
|
|
* - Scans configured paths for Boot classes with `$listens` declarations
|
|
|
|
|
* - Wires lazy listeners for each event-module pair
|
|
|
|
|
*
|
|
|
|
|
* **Boot Phase (boot())**
|
|
|
|
|
* - Fires queue worker event if in queue context
|
|
|
|
|
* - Schedules FrameworkBooted event via `$app->booted()`
|
|
|
|
|
*
|
|
|
|
|
* **Event Firing (static fire* methods)**
|
|
|
|
|
* - Called by frontage modules (Web, Admin, Api, etc.) at appropriate times
|
|
|
|
|
* - Fire events, collect requests, and process them with appropriate middleware
|
|
|
|
|
*
|
2026-01-26 14:24:25 +00:00
|
|
|
* ## Request Processing Flow
|
|
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
* Event created ──► event() dispatched ──► Listeners collect requests
|
|
|
|
|
* │
|
|
|
|
|
* ▼
|
|
|
|
|
* ┌─────────────────────┐
|
|
|
|
|
* │ $event->routes() │
|
|
|
|
|
* │ $event->views() │
|
|
|
|
|
* │ $event->livewire() │
|
|
|
|
|
* └─────────┬───────────┘
|
|
|
|
|
* │
|
|
|
|
|
* ▼
|
|
|
|
|
* ┌─────────────────────┐
|
|
|
|
|
* │ fire*() processes │
|
|
|
|
|
* │ collected requests: │
|
|
|
|
|
* │ - View namespaces │
|
|
|
|
|
* │ - Livewire comps │
|
|
|
|
|
* │ - Middleware routes │
|
|
|
|
|
* └─────────────────────┘
|
|
|
|
|
* ```
|
|
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* ## Module Declaration
|
|
|
|
|
*
|
|
|
|
|
* Modules declare interest in events via static `$listens` arrays in their Boot class:
|
|
|
|
|
*
|
|
|
|
|
* ```php
|
|
|
|
|
* class Boot
|
|
|
|
|
* {
|
2026-01-21 14:11:45 +00:00
|
|
|
* public static array $listens = [
|
|
|
|
|
* WebRoutesRegistering::class => 'onWebRoutes',
|
|
|
|
|
* AdminPanelBooting::class => 'onAdmin',
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* ConsoleBooting::class => ['onConsole', 10], // With priority
|
2026-01-21 14:11:45 +00:00
|
|
|
* ];
|
|
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* public function onWebRoutes(WebRoutesRegistering $event): void
|
|
|
|
|
* {
|
|
|
|
|
* $event->routes(fn () => require __DIR__.'/Routes/web.php');
|
|
|
|
|
* $event->views('mymodule', __DIR__.'/Views');
|
|
|
|
|
* }
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
|
|
|
|
*
|
|
|
|
|
* The module is only instantiated when its registered events actually fire,
|
|
|
|
|
* enabling efficient lazy loading based on request context.
|
|
|
|
|
*
|
|
|
|
|
* ## Default Scan Paths
|
|
|
|
|
*
|
|
|
|
|
* By default, scans these directories under `app_path()`:
|
|
|
|
|
* - `Core` - Core system modules
|
|
|
|
|
* - `Mod` - Feature modules
|
|
|
|
|
* - `Website` - Website/domain-specific modules
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @see ModuleScanner For module discovery
|
|
|
|
|
* @see ModuleRegistry For listener registration
|
|
|
|
|
* @see LazyModuleListener For lazy instantiation
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
class LifecycleEventProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Directories to scan for modules with $listens declarations.
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
*
|
|
|
|
|
* @var array<string>
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
protected array $scanPaths = [];
|
|
|
|
|
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
/**
|
|
|
|
|
* Register module infrastructure and wire lazy listeners.
|
|
|
|
|
*
|
|
|
|
|
* This method:
|
|
|
|
|
* 1. Registers ModuleScanner and ModuleRegistry as singletons
|
|
|
|
|
* 2. Configures default scan paths (Core, Mod, Website)
|
|
|
|
|
* 3. Triggers module scanning and listener registration
|
|
|
|
|
*
|
|
|
|
|
* Runs early in the application lifecycle before boot().
|
|
|
|
|
*/
|
2026-01-21 14:11:45 +00:00
|
|
|
public function register(): void
|
|
|
|
|
{
|
|
|
|
|
// Register infrastructure
|
|
|
|
|
$this->app->singleton(ModuleScanner::class);
|
|
|
|
|
$this->app->singleton(ModuleRegistry::class, function ($app) {
|
|
|
|
|
return new ModuleRegistry($app->make(ModuleScanner::class));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Scan and wire lazy listeners
|
2026-01-26 17:52:21 +00:00
|
|
|
// Start with configured application module paths
|
|
|
|
|
$this->scanPaths = config('core.module_paths', [
|
2026-01-21 14:11:45 +00:00
|
|
|
app_path('Core'),
|
|
|
|
|
app_path('Mod'),
|
|
|
|
|
app_path('Website'),
|
2026-01-26 17:52:21 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// Add framework's own module paths (works in vendor/ or packages/)
|
|
|
|
|
$frameworkSrcPath = dirname(__DIR__); // .../src/Core -> .../src
|
|
|
|
|
$this->scanPaths[] = $frameworkSrcPath.'/Core'; // Core\*\Boot
|
|
|
|
|
$this->scanPaths[] = $frameworkSrcPath.'/Mod'; // Mod\*\Boot
|
|
|
|
|
|
|
|
|
|
// Filter to only existing directories
|
|
|
|
|
$this->scanPaths = array_filter($this->scanPaths, 'is_dir');
|
2026-01-21 14:11:45 +00:00
|
|
|
|
|
|
|
|
$registry = $this->app->make(ModuleRegistry::class);
|
|
|
|
|
$registry->register($this->scanPaths);
|
|
|
|
|
}
|
|
|
|
|
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
/**
|
|
|
|
|
* Boot the provider and schedule late-stage events.
|
|
|
|
|
*
|
|
|
|
|
* Fires queue worker event if running in queue context, and schedules
|
|
|
|
|
* the FrameworkBooted event to fire after all providers have booted.
|
|
|
|
|
*
|
|
|
|
|
* Note: Most lifecycle events (Web, Admin, API, etc.) are fired by their
|
|
|
|
|
* respective frontage modules, not here.
|
|
|
|
|
*/
|
2026-01-21 14:11:45 +00:00
|
|
|
public function boot(): void
|
|
|
|
|
{
|
|
|
|
|
// Console event now fired by Core\Front\Cli\Boot
|
|
|
|
|
|
|
|
|
|
// Fire queue worker event for queue context
|
|
|
|
|
if ($this->app->bound('queue.worker')) {
|
|
|
|
|
$this->fireQueueWorkerBooting();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Framework booted event fires after all providers have booted
|
|
|
|
|
$this->app->booted(function () {
|
|
|
|
|
event(new FrameworkBooted);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Fire WebRoutesRegistering and process collected requests.
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Called by Front/Web/Boot when web middleware is being set up. This method:
|
|
|
|
|
*
|
|
|
|
|
* 1. Fires the WebRoutesRegistering event to all listeners
|
|
|
|
|
* 2. Processes view namespace requests (adds them to the view finder)
|
|
|
|
|
* 3. Processes Livewire component requests (registers with Livewire)
|
|
|
|
|
* 4. Processes route requests (wraps with 'web' middleware)
|
|
|
|
|
* 5. Refreshes route name and action lookups
|
|
|
|
|
*
|
|
|
|
|
* Routes registered through this event are automatically wrapped with
|
|
|
|
|
* the 'web' middleware group for session, CSRF, etc.
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
public static function fireWebRoutes(): void
|
|
|
|
|
{
|
|
|
|
|
$event = new WebRoutesRegistering;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
// Process view namespace requests
|
|
|
|
|
foreach ($event->viewRequests() as [$namespace, $path]) {
|
|
|
|
|
if (is_dir($path)) {
|
|
|
|
|
view()->addNamespace($namespace, $path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process Livewire component requests
|
|
|
|
|
foreach ($event->livewireRequests() as [$alias, $class]) {
|
|
|
|
|
if (class_exists(Livewire::class)) {
|
|
|
|
|
Livewire::component($alias, $class);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process route requests
|
|
|
|
|
foreach ($event->routeRequests() as $callback) {
|
|
|
|
|
Route::middleware('web')->group($callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Refresh route lookups after adding routes
|
|
|
|
|
app('router')->getRoutes()->refreshNameLookups();
|
|
|
|
|
app('router')->getRoutes()->refreshActionLookups();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Fire AdminPanelBooting and process collected requests.
|
|
|
|
|
*
|
|
|
|
|
* Called by Front/Admin/Boot when admin routes are being set up. This method:
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* 1. Fires the AdminPanelBooting event to all listeners
|
|
|
|
|
* 2. Processes view namespace requests
|
|
|
|
|
* 3. Processes translation namespace requests
|
|
|
|
|
* 4. Processes Livewire component requests
|
|
|
|
|
* 5. Processes route requests (wraps with 'admin' middleware)
|
|
|
|
|
*
|
|
|
|
|
* Routes registered through this event are automatically wrapped with
|
|
|
|
|
* the 'admin' middleware group for authentication, authorization, etc.
|
|
|
|
|
*
|
|
|
|
|
* Navigation items are handled separately via AdminMenuProvider interface.
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
public static function fireAdminBooting(): void
|
|
|
|
|
{
|
|
|
|
|
$event = new AdminPanelBooting;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
// Process view namespace requests
|
|
|
|
|
foreach ($event->viewRequests() as [$namespace, $path]) {
|
|
|
|
|
if (is_dir($path)) {
|
|
|
|
|
view()->addNamespace($namespace, $path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process translation requests
|
|
|
|
|
foreach ($event->translationRequests() as [$namespace, $path]) {
|
|
|
|
|
if (is_dir($path)) {
|
|
|
|
|
app('translator')->addNamespace($namespace, $path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process Livewire component requests
|
|
|
|
|
foreach ($event->livewireRequests() as [$alias, $class]) {
|
|
|
|
|
if (class_exists(Livewire::class)) {
|
|
|
|
|
Livewire::component($alias, $class);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process route requests with admin middleware
|
|
|
|
|
foreach ($event->routeRequests() as $callback) {
|
|
|
|
|
Route::middleware('admin')->group($callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note: Navigation is handled via AdminMenuProvider interface.
|
|
|
|
|
// Modules implementing that interface will have their navigation
|
|
|
|
|
// registered through the existing AdminMenuRegistry::register() call.
|
|
|
|
|
// The $event->navigation() requests are available for future use
|
|
|
|
|
// when we move away from the AdminMenuProvider pattern.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Fire ClientRoutesRegistering and process collected requests.
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Called by Front/Client/Boot when client dashboard routes are being set up.
|
|
|
|
|
* This is for authenticated SaaS customers managing their namespace (bio pages,
|
|
|
|
|
* settings, analytics, etc.).
|
|
|
|
|
*
|
|
|
|
|
* Routes registered through this event are automatically wrapped with
|
|
|
|
|
* the 'client' middleware group.
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
public static function fireClientRoutes(): void
|
|
|
|
|
{
|
|
|
|
|
$event = new ClientRoutesRegistering;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
// Process view namespace requests
|
|
|
|
|
foreach ($event->viewRequests() as [$namespace, $path]) {
|
|
|
|
|
if (is_dir($path)) {
|
|
|
|
|
view()->addNamespace($namespace, $path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process Livewire component requests
|
|
|
|
|
foreach ($event->livewireRequests() as [$alias, $class]) {
|
|
|
|
|
if (class_exists(Livewire::class)) {
|
|
|
|
|
Livewire::component($alias, $class);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Process route requests with client middleware
|
|
|
|
|
foreach ($event->routeRequests() as $callback) {
|
|
|
|
|
Route::middleware('client')->group($callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Refresh route lookups after adding routes
|
|
|
|
|
app('router')->getRoutes()->refreshNameLookups();
|
|
|
|
|
app('router')->getRoutes()->refreshActionLookups();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Fire ApiRoutesRegistering and process collected requests.
|
|
|
|
|
*
|
|
|
|
|
* Called by Front/Api/Boot when REST API routes are being set up.
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
2026-03-04 12:39:44 +00:00
|
|
|
* Routes registered through this event are automatically wrapped
|
|
|
|
|
* with the 'api' middleware group (stateless, no CSRF).
|
|
|
|
|
* No prefix is applied — API routes live on domain-scoped subdomains
|
|
|
|
|
* (e.g., api.lthn.ai/v1/brain/recall).
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
public static function fireApiRoutes(): void
|
|
|
|
|
{
|
|
|
|
|
$event = new ApiRoutesRegistering;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
// Process route requests with api middleware
|
|
|
|
|
foreach ($event->routeRequests() as $callback) {
|
2026-03-04 12:39:44 +00:00
|
|
|
Route::middleware('api')->group($callback);
|
2026-01-21 14:11:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-03 21:52:55 +00:00
|
|
|
/**
|
|
|
|
|
* Fire McpRoutesRegistering and process collected requests.
|
|
|
|
|
*
|
|
|
|
|
* Called by Front/Mcp/Boot when MCP protocol routes are being set up.
|
|
|
|
|
* Routes registered through this event are automatically wrapped with
|
|
|
|
|
* the 'mcp' middleware group (stateless, rate limiting).
|
|
|
|
|
*
|
|
|
|
|
* No prefix is applied — MCP routes live at the domain root
|
|
|
|
|
* (e.g., mcp.host.uk.com/tools/call).
|
|
|
|
|
*/
|
|
|
|
|
public static function fireMcpRoutes(): void
|
|
|
|
|
{
|
|
|
|
|
$event = new McpRoutesRegistering;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
// Process route requests with mcp middleware
|
|
|
|
|
foreach ($event->routeRequests() as $callback) {
|
|
|
|
|
Route::middleware('mcp')->group($callback);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-21 14:11:45 +00:00
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Fire McpToolsRegistering and return collected handler classes.
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Called by the MCP (Model Context Protocol) server command when loading tools.
|
|
|
|
|
* Modules register their MCP tool handlers through this event.
|
2026-01-21 14:11:45 +00:00
|
|
|
*
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* @return array<string> Fully qualified class names of McpToolHandler implementations
|
|
|
|
|
*
|
|
|
|
|
* @see \Core\Front\Mcp\Contracts\McpToolHandler
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
public static function fireMcpTools(): array
|
|
|
|
|
{
|
|
|
|
|
$event = new McpToolsRegistering;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
return $event->handlers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Fire ConsoleBooting and register collected Artisan commands.
|
|
|
|
|
*
|
|
|
|
|
* Called when running in CLI context. Modules register their Artisan
|
|
|
|
|
* commands through the event's `command()` method.
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
protected function fireConsoleBooting(): void
|
|
|
|
|
{
|
|
|
|
|
$event = new ConsoleBooting;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
// Process command requests
|
|
|
|
|
if (! empty($event->commandRequests())) {
|
|
|
|
|
$this->commands($event->commandRequests());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
Add dependency guards and PHPDoc documentation
Dependency guards for optional modules:
- Remove hard use statements for Core\Mod\*, Core\Plug\* classes
- Add class_exists() guards before using optional dependencies
- Change type hints to ?object with docblock annotations
- Add fallback behavior when optional modules not installed
Files with dependency guards added:
- Cdn/Console/CdnPurge.php (Workspace, Purge)
- Cdn/Console/PushAssetsToCdn.php (VBucket)
- Cdn/Boot.php (CdnManager, StorageManager)
- Cdn/Jobs/PushAssetToCdn.php (StorageManager)
- Front/Admin/AdminMenuRegistry.php (User, Workspace, EntitlementService)
- Front/Admin/Contracts/*.php (User, Workspace)
- Front/Admin/View/Components/Sidemenu.php (User, WorkspaceService)
- Front/Mcp/McpContext.php (AgentPlan)
Comprehensive PHPDoc documentation:
- ModuleScanner.php - Scanner mechanics and priority system
- ModuleRegistry.php - Registration flow and querying
- LazyModuleListener.php - Lazy loading mechanism
- LifecycleEventProvider.php - Lifecycle phases
- All Event classes - When fired, context, examples
- Service contracts - HealthCheckable, ServiceDefinition
- Admin contracts - AdminMenuProvider, DynamicMenuProvider
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:39 +00:00
|
|
|
* Fire QueueWorkerBooting for queue worker context.
|
|
|
|
|
*
|
|
|
|
|
* Called when the application is running as a queue worker. Modules can
|
|
|
|
|
* use this event for queue-specific initialization.
|
2026-01-21 14:11:45 +00:00
|
|
|
*/
|
|
|
|
|
protected function fireQueueWorkerBooting(): void
|
|
|
|
|
{
|
|
|
|
|
$event = new QueueWorkerBooting;
|
|
|
|
|
event($event);
|
|
|
|
|
|
|
|
|
|
// Job registration handled by Laravel's queue system
|
|
|
|
|
}
|
|
|
|
|
}
|