orm icon indicating copy to clipboard operation
orm copied to clipboard

[FEATURE] Laravel Debugbar Logging Middleware

Open cheack opened this issue 2 years ago • 0 comments

This pull request introduces middleware support for Laravel Debugbar, extending functionality by adding a middleware stack to log queries and measure query execution time.

Example queries:

app('em')->getConnection()->executeQuery("SELECT 'raw query'");
app('em')->getConnection()->executeQuery("SELECT :query", ['query' => 'prepared query']);
app('em')->getConnection()->executeQuery('SELECT pg_sleep(1)');
app('em')->getConnection()->executeQuery('SELECT pg_sleep(2)');
User::pluck('id');

Result: image

Usage (doctrine.php config):

'middlewares' => [
    \LaravelDoctrine\ORM\DBAL\Middleware\LaravelDebugbarLogging\Middleware::class
]

I'm going to add the tests later, after one of the reviewers confirms that my changes make sense.

cheack avatar Oct 18 '23 18:10 cheack