ahmed-bhs/doctrine-doctor
Doctrine Doctor is a runtime analysis tool for Doctrine ORM integrated into the Symfony Web Profiler. It detects real-world issues like N+1 queries, slow queries, missing indexes, hydration overhead, and injection risks, with actionable backtraces and suggestions.
Detailed installation guide for Doctrine Doctor.
composer require --dev ahmed-bhs/doctrine-doctor
{: .warning }
Development Only: Always install Doctrine Doctor as a development dependency (
--dev). Never use it in production.
If you're using Symfony Flex, the bundle is automatically configured. The recipe creates:
config/
└── packages/
└── dev/
└── doctrine_doctor.yaml
with default configuration:
doctrine_doctor:
enabled: true
If you're not using Symfony Flex, register the bundle manually:
<?php
// config/bundles.php
return [
// ...
AhmedBhs\DoctrineDoctor\DoctrineDoctorBundle::class => ['dev' => true],
];
Then create the configuration file:
# config/packages/dev/doctrine_doctor.yaml
doctrine_doctor:
enabled: true
Check that the bundle is loaded:
php bin/console debug:container --parameter=kernel.bundles
You should see DoctrineDoctorBundle in the list.
To see code location backtraces in issue reports:
# config/packages/dev/doctrine.yaml
doctrine:
dbal:
profiling_collect_backtrace: true
dev environmentphp bin/console cache:clearconfig/bundles.php with ['dev' => true]doctrine_doctor.enabled is trueIf using the Missing Index Analyzer, ensure your database user has SELECT permissions to execute EXPLAIN queries.
How can I help you explore Laravel packages today?