This package is under development. Please do not use in production yet 🙏
TODO
$ composer require --dev pana1990/php-web-profiler
Example usage with slim framework:
require __DIR__ . '/vendor/autoload.php';
$app = AppFactory::create();
// services
Db::setUp(); // setup schema
$pdoTraceable = new PdoTraceable('sqlite:' . __DIR__ . '/src/db/bbdd.db');
$log = (new Logger('log'))->pushHandler(new ErrorLogHandler());
$traceableLogger = new LoggerTraceable($log);
// setup for PhpWebProfiler
SlimPhpWebProfilerBuilder::fromApp($app)
->withPdo($pdoTraceable)
->withLogger($traceableLogger)
->build();
$app->get('/', function (Request $request, Response $response) use ($traceableLogger, $pdoTraceable) {
$response->getBody()->write('Hello world!');
$traceableLogger->error('This is an error message');
$pdoTraceable->exec('INSERT INTO test (title) VALUES ("test");');
$pdoTraceable->exec('SELECT * FROM test;');
return $response;
});
$app->run();
See full example in here.
Note: with this setup you have two endpoints enabled (
debug
anddebug/:token
)
Index page
Request panel
Log panel
Database panel
[ ] Add support for slim
php-web-profiler is released under the MIT License. See the bundled LICENSE for details.