This is a set of extensions to make working with Flight a little richer.
$_SERVER
$_GET
$_POST
$_FILES
$_SESSION
This is the Panel
And each panel displays very helpful information about your application!
Click here to view the code.
Run composer require flightphp/tracy-extensions --dev and you're on your way!
composer require flightphp/tracy-extensions --dev
There is very little configuration you need to do to get this started. You will need to initiate the Tracy debugger prior to using this https://tracy.nette.org/en/guide:
<?php use Tracy\Debugger; use flight\debug\tracy\TracyExtensionLoader; // bootstrap code require __DIR__ . '/vendor/autoload.php'; Debugger::enable(); // You may need to specify your environment with Debugger::enable(Debugger::DEVELOPMENT) // if you use database connections in your app, there is a // required PDO wrapper to use ONLY IN DEVELOPMENT (not production please!) // It has the same parameters as a regular PDO connection $pdo = new PdoQueryCapture('sqlite:test.db', 'user', 'pass'); // or if you attach this to the Flight framework Flight::register('db', PdoQueryCapture::class, ['sqlite:test.db', 'user', 'pass']); // now whenever you make a query it will capture the time, query, and parameters // This connects the dots if(Debugger::$showBar === true) { // This needs to be false or Tracy can't actually render :( Flight::set('flight.content_length', false); new TracyExtensionLoader(Flight::app()); } // more code Flight::start();
If you have a custom session handler (such as ghostff/session), you can pass any array of session data to Tracy and it will automatically output it for you. You pass it in with the session_data key in the second parameter of the TracyExtensionLoader constructor.
session_data
TracyExtensionLoader
use Ghostff\Session\Session; require 'vendor/autoload.php'; $app = Flight::app(); $app->register('session', Session::class); if(Debugger::$showBar === true) { // This needs to be false or Tracy can't actually render :( Flight::set('flight.content_length', false); new TracyExtensionLoader(Flight::app(), [ 'session_data' => Flight::session()->getAll() ]); } // routes and other things... Flight::start();
If you have Latte installed in your project, you can use the Latte panel to analyze your templates. You can pass in the Latte instance to the TracyExtensionLoader constructor with the latte key in the second parameter.
latte
use Latte\Engine; require 'vendor/autoload.php'; $app = Flight::app(); $app->register('latte', Engine::class, [], function($latte) { $latte->setTempDirectory(__DIR__ . '/temp'); // this is where you add the Latte Panel to Tracy $latte->addExtension(new Latte\Bridges\Tracy\TracyExtension); }); if(Debugger::$showBar === true) { // This needs to be false or Tracy can't actually render :( Flight::set('flight.content_length', false); new TracyExtensionLoader(Flight::app()); }