事件监听
<?php
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Framework\Event\BootApplication;
use Hyperf\Nano\Factory\AppFactory;
require_once __DIR__ . '/vendor/autoload.php';
$app = AppFactory::create();
$app->addListener(BootApplication::class, function($event){
$this->get(StdoutLoggerInterface::class)->info('App started');
});
$app->run();