toolbar example


    }

    /** * If the debug flag is set (CI_DEBUG) then collect performance * and debug information and display it in a toolbar. * * @param array|null $arguments */
    public function after(RequestInterface $request, ResponseInterface $response$arguments = null)
    {
        Services::toolbar()->prepare($request$response);
    }
}
if (CI_DEBUG && ! is_cli()) {
            $app = Services::codeigniter();

            $request ??= Services::request();
            $response ??= Services::response();

            // Disable the toolbar for downloads             if ($response instanceof DownloadResponse) {
                return;
            }

            $toolbar = Services::toolbar(config(ToolbarConfig::class));
            $stats   = $app->getPerformanceStats();
            $data    = $toolbar->run(
                $stats['startTime'],
                $stats['totalTime'],
                $request,
                $response
            );

            helper('filesystem');

            // Updated to microtime() so we can get history
ob_start(static fn ($buffer) => $buffer);
    }

    /* * -------------------------------------------------------------------- * Debug Toolbar Listeners. * -------------------------------------------------------------------- * If you delete, they will no longer be collected. */
    if (CI_DEBUG && ! is_cli()) {
        Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
        Services::toolbar()->respond();
        // Hot Reload route - for framework use on the hot reloader.         if (ENVIRONMENT === 'development') {
            Services::routes()->get('__hot-reload', static function D) {
                (new HotReloader())->run();
            });
        }
    }
});
Home | Imprint | This part of the site doesn't use cookies.