Installation
Detailed installation guide for Doctrine Doctor.
Requirements
- PHP: 8.4 or higher
- Symfony: 6.x, 7.x, or 8.x
- Doctrine ORM: 3.x or 4.x
Install via Composer
composer require --dev ahmed-bhs/doctrine-doctor
Development Only: Always install Doctrine Doctor as a development dependency (
--dev). Never use it in production.
Symfony Flex Auto-Configuration
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
Manual Configuration (Without Flex)
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
Verify Installation
Check that the bundle is loaded:
php bin/console debug:container --parameter=kernel.bundles
You should see DoctrineDoctorBundle in the list.
Enable Backtraces (Optional but Recommended)
To see code location backtraces in issue reports:
# config/packages/dev/doctrine.yaml
doctrine:
dbal:
profiling_collect_backtrace: true
Troubleshooting
Bundle Not Showing in Profiler
- Check environment: Ensure you’re in
devenvironment - Clear cache: Run
php bin/console cache:clear - Check bundle registration: Verify bundle is in
config/bundles.phpwith['dev' => true]
No Issues Detected
- Execute queries: Make sure your page executes database queries
- Check configuration: Verify
doctrine_doctor.enabledistrue - Review thresholds: Some analyzers might have high thresholds
Permission Issues
If using the Missing Index Analyzer, ensure your database user has SELECT permissions to execute EXPLAIN queries.