change container to php-di

This commit is contained in:
sunxyw
2022-12-25 17:42:32 +08:00
parent 60ce722010
commit 05b3446f59
23 changed files with 280 additions and 1218 deletions

View File

@@ -21,6 +21,7 @@ use OneBot\Driver\Workerman\WorkermanDriver;
use OneBot\Util\Singleton;
use ZM\Command\Server\ServerStartCommand;
use ZM\Config\ZMConfig;
use ZM\Container\ContainerBindingListener;
use ZM\Event\Listener\HttpEventListener;
use ZM\Event\Listener\ManagerEventListener;
use ZM\Event\Listener\MasterEventListener;
@@ -93,7 +94,7 @@ class Framework
{
// 顺序执行引导器
foreach ($this->bootstrappers as $bootstrapper) {
app($bootstrapper)->bootstrap($this->argv);
resolve($bootstrapper)->bootstrap($this->argv);
}
// 初始化 @OnSetup 事件
@@ -222,6 +223,8 @@ class Framework
$this->printMotd();
}
ContainerBindingListener::listenForEvents();
// 添加框架需要监听的顶层事件监听器
// worker 事件
ob_event_provider()->addEventListener(WorkerStartEvent::getName(), [WorkerEventListener::getInstance(), 'onWorkerStart999'], 999);