php-framework/stubs/Mod/Example/Boot.php.stub
Snider 392678e68a Initial release: Core PHP modular monolith framework
- Event-driven architecture with lazy module loading
- ModuleScanner, ModuleRegistry, LazyModuleListener for module discovery
- 7 lifecycle events: Web, Admin, API, Client, Console, MCP, FrameworkBooted
- AdminMenuProvider and ServiceDefinition contracts
- Artisan commands: make:mod, make:website, make:plug
- Module stubs for rapid scaffolding
- Comprehensive test suite with Orchestra Testbench
- GitHub Actions CI for PHP 8.2-8.4 / Laravel 11-12
- EUPL-1.2 license

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 17:02:28 +00:00

44 lines
991 B
Text

<?php
declare(strict_types=1);
namespace Mod\{{ name }};
use Core\Events\AdminPanelBooting;
use Core\Events\WebRoutesRegistering;
use Illuminate\Support\ServiceProvider;
class Boot extends ServiceProvider
{
/**
* Events this module listens to.
*
* The module is only instantiated when these events fire.
*/
public static array $listens = [
WebRoutesRegistering::class => 'onWebRoutes',
AdminPanelBooting::class => 'onAdmin',
];
/**
* Handle web routes registration.
*/
public function onWebRoutes(WebRoutesRegistering $event): void
{
$event->views('{{ slug }}', __DIR__.'/Views');
$event->routes(function () {
require __DIR__.'/Routes/web.php';
});
}
/**
* Handle admin panel booting.
*/
public function onAdmin(AdminPanelBooting $event): void
{
$event->routes(function () {
require __DIR__.'/Routes/admin.php';
});
}
}