dzegarra / tracy-mysqli
This lib extends mysqli to allow you to see all your executed queries. It also includes a Bar Panel for Tracy
Installs: 7 488
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 17
Open Issues: 1
Type:package
Requires
- tracy/tracy: ^2.4
Suggests
- jdorn/sql-formatter: Highlight the SQL logged queries
This package is not auto-updated.
Last update: 2024-11-13 20:51:58 UTC
README
This lib allow you to see all your executed SQL queries when you are using the MySQLi php driver. It also includes a Bar Panel for Tracy, see the result below.
Result
Installation
Install it via composer:
composer require dzegarra/tracy-mysqli
How to use
// Create an instance for Tracy Bar Panel $panel = new \Dzegarra\TracyMysqli\BarPanel(); // Add the panel to Tracy \Tracy\Debugger::getBar()->addPanel($panel); // Make a connection to the DB using the \Dzegarra\TracyMysqli\Mysqli class instead of mysqli $conn = new \Dzegarra\TracyMysqli\Mysqli("hostname", "username", "password", "database"); // Execute your queries
How it works
First you need to add the panel to the Tracy bar. The panel won't be render until the shutdown
process kick in (either way the script ends or you call die
or exit
).
Just before the panel start to render the list of all the SQL querys will be fetched from the Mysqli class.
All the queries are store in a static variable in the Mysqli so, no matters how many instances of the Mysqli class you create, all the queries of all the instances will be store.
Inspiration and credits
This repo is based in filisko/pdo-plus.