1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-23 18:33:45 +01:00
php-dibi/examples/tracy-and-exceptions.php

32 lines
677 B
PHP
Raw Normal View History

2008-07-17 03:51:29 +00:00
<?php
2017-06-09 22:20:47 +02:00
declare(strict_types=1);
if (@!include __DIR__ . '/../vendor/autoload.php') {
die('Install dependencies using `composer install --dev`');
}
2008-07-17 03:51:29 +00:00
2008-10-28 02:06:55 +00:00
2015-01-10 19:03:16 +01:00
// enable Tracy
Tracy\Debugger::enable();
2008-07-17 03:51:29 +00:00
2018-04-17 10:03:43 +02:00
$dibi = new Dibi\Connection([
'driver' => 'sqlite',
'database' => 'data/sample.s3db',
2015-10-06 01:39:01 +02:00
]);
2015-01-10 19:03:16 +01:00
// add panel to debug bar
$panel = new Dibi\Bridges\Tracy\Panel;
2018-04-17 10:03:43 +02:00
$panel->register($dibi);
2008-07-17 03:51:29 +00:00
2010-08-03 11:48:51 +02:00
// throws error because SQL is bad
2018-04-17 10:03:43 +02:00
$dibi->query('SELECT FROM customers WHERE customer_id < ?', 38);
?><!DOCTYPE html><link rel="stylesheet" href="data/style.css">
<h1>Tracy & SQL Exceptions | dibi</h1>
<p>Dibi can display and log exceptions via <a href="https://tracy.nette.org">Tracy</a>.</p>