コード例 #1
0
 /**
  * @param HttpDispatcher $dispatcher
  */
 public function boot(HttpDispatcher $dispatcher)
 {
     $dispatcher->riseMiddleware(function (Request $request, Response $response, $next) {
         $start = microtime(true);
         /**
          * @var Response $response
          */
         $response = $next($request, $response);
         return $response->withHeader('X-Elapsed', number_format(microtime(true) - $start, 4));
     });
 }
コード例 #2
0
 /**
  * @param HttpDispatcher   $dispatcher
  * @param FactoryInterface $factory
  */
 public function boot(HttpDispatcher $dispatcher, FactoryInterface $factory)
 {
     $dispatcher->riseMiddleware($factory->make(ProfilerWrapper::class, ['started' => microtime(true)]));
 }