<?php
class App
{
public function __construct()
{
$this->db = new Db();
$this->engine = new Twig();
}
public function run($request)
{
return (new Router(
new Endpoint('/foo', new FooController($this->twig, /* Services, Repos, etc */)),
new Endpoint('/bar', new BarController($this->twig, /* Services, Repos, etc */)),
new Endpoint('/baz', new BazController($this->twig, /* Services, Repos, etc */)),
// ... etc
))->route($request);
}
}
class Controller
{
public function __construct(Engine $engine, /* ... */)
{
$this->engine = $engine;
}
public function response()
{
return new Response(..., $this->engine->render('/file', $data));
}
}
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).