tracy.php 858 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. if (@!include __DIR__ . '/../vendor/autoload.php') {
  4. die('Install dependencies using `composer install --dev`');
  5. }
  6. // enable Tracy
  7. Tracy\Debugger::enable();
  8. $dibi = new Dibi\Connection([
  9. 'driver' => 'sqlite',
  10. 'database' => 'data/sample.s3db',
  11. ]);
  12. // add panel to debug bar
  13. $panel = new Dibi\Bridges\Tracy\Panel;
  14. $panel->register($dibi);
  15. // query will be logged
  16. $dibi->query('SELECT 123');
  17. // result set will be dumped
  18. Tracy\Debugger::barDump($dibi->fetchAll('SELECT * FROM customers WHERE customer_id < ?', 38), '[customers]');
  19. ?>
  20. <!DOCTYPE html><link rel="stylesheet" href="data/style.css">
  21. <style> html { background: url(data/arrow.png) no-repeat bottom right; height: 100%; } </style>
  22. <h1>Tracy | dibi</h1>
  23. <p>Dibi can log queries and dump variables to the <a href="https://tracy.nette.org">Tracy</a>.</p>