public function run(Routable $routable, Endpoint ...$endpoints) { $this->bootstrap->run($this->container, function () use($routable, $endpoints) { $compiler = $this->container->get(RouteCompiler::class); foreach ($endpoints as $endpoint) { $endpoint->listen(new Dispatcher($this->container, $routable, $compiler)); } }); }
<?php use KoolKode\K1\Bootstrap; require __DIR__ . '/vendor/autoload.php'; $boot = new Bootstrap(); // Register app-specific paths: $boot->addBindingPath(__DIR__ . '/bind'); $boot->addConfigPath(__DIR__ . '/config'); $boot->addResourcePath(__DIR__ . '/resource/app'); $boot->addPublicResourcePath(__DIR__ . '/resource/app/public'); // Observe these files / dirs when running in dev mode: $boot->observeFile(__FILE__); $boot->observeFile(__DIR__ . '/composer.lock'); $boot->observeDirectory(__DIR__ . '/app'); $boot->observeDirectory(__DIR__ . '/bind'); $boot->observeDirectory(__DIR__ . '/config'); $boot->observeDirectory(__DIR__ . '/src'); $k1 = $boot->init(); $k1->runConsole();