Download the PHP package phpexpertsinc/doctrine-detective without Composer
On this page you can find all versions of the php package phpexpertsinc/doctrine-detective. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpexpertsinc/doctrine-detective
More information about phpexpertsinc/doctrine-detective
Files in phpexpertsinc/doctrine-detective
Package doctrine-detective
Short Description A Symfony2 Bundle that provides a detailed SQL query log for both HTML and JSON responses, including the SQL query, its location, and duration, organized by Controller -> Service -> Repository.
License MIT
Informations about the package doctrine-detective
Doctrine Detective Bundle
Doctrine Detective is a Symfony2 Bundle that provides a detailed SQL query log for both HTML and JSON responses, including the SQL query, its location, and duration, organized by Controller -> Service -> Repository.
It is mainly useful for debugging, profiling and refactoring your Doctrine ORM queries into far more efficient Doctrine DBAL queries.
Unlike other SQL loggers, Doctrine Detective has the following features:
- Queries are organized hierarchically by class and method.
- Prepared statements have the parameters interpolated, so you can directly query them against the database.
- RESTful API support.
Installation
- Add
"phpexpertsinc/doctrine-detective" : "1.*"
to your composer.json. - Run
$ composer update phpexpertsinc/doctrine-detective
. - Edit
app/appKernel.php
. - Add
new PHPExperts\DoctrineDetectiveBundle\DoctrineDetectiveBundle(),
to theAppKernel::registerBundles()
array. -or- (prefered), add it to just thedev
andtest
environments:
Output
HTML Response
At the end of every HTML response, you will find the following:
<div class="doctrineDetective-SQLLog">
<table>
<tr>
<td>TestController::getActiveUsersAction</td>
<td>3.886604999847429 ms</td>
<td>-</td>
</tr>
<tr>
<td>UserService</td>
<td>3.37965652160646 ms</td>
<td>-</td>
</tr>
<tr>
<td>UserService::getUsers(), Line 210</td>
<td>2.622127532959 ms</td>
<td>SELECT * FROM users WHERE ids IN (1, 2, 3, 4, 5)</td>
</tr>
<tr>
<td>UserRepository</td>
<td>0.75697898864746 ms</td>
<td>-</td>
</tr>
<tr>
<td>UserRepository::isActive(), Line 115</td>
<td>0.75697898864746</td>
<td>SELECT last_visit FROM login_log WHERE userId IN (1, 2, 3, 4, 5)</td>
</tr>
</table>
</div>
JSON Response
At the end of your JSON response, you will find the sqlLog
array:
"sqlLog": {
"TestController::getActiveUsersAction": {
"time": 3.886604999847429,
"UserService": {
"time": 3.37965652160646,
"getUsers": {
"time": 2.622127532959,
"queries": [
{
"query": "SELECT * FROM users WHERE ids IN (1, 2, 3, 4, 5)",
"line": 210,
"time": 2.622127532959
}
]
},
},
"UserRepository": {
"isActive": {
"time": 0.75697898864746,
"queries": [
{
"query": "SELECT last_visit FROM login_log WHERE userId IN (1, 2, 3, 4, 5)",
"line": 115,
"time": 0.75697898864746
}
]
},
}
}
}
All versions of doctrine-detective with dependencies
symfony/dependency-injection Version 2.*
doctrine/orm Version *
doctrine/doctrine-bundle Version *
php Version >=5.4