Repository navigation
Composer: remove unused requirements, replace doctrine/common by doctrine/collections, declare the packages used directly #149
Description
Description
Same cleanup as cleverage/process-bundle#268 (PR cleverage/process-bundle#281): some composer.json requirements are not used by the bundle but are forced on every application using it, and some packages used directly are only installed transitively (best practices for reusable bundles).
Checked on main @ d664410 (v3.2), in src/, config/, templates/ and tests/.
1. Unused requirements
| Requirement | Usage |
|---|---|
symfony/dotenv |
None. Application concern (.env loading, tests/bootstrap.php of the application) |
symfony/runtime |
None (no autoload_runtime.php, no runtime class). Application concern (bin/console, public/index.php); also listed in config.allow-plugins |
ext-ctype, ext-iconv |
None (no ctype_* / iconv* call). Leftovers of the Symfony skeleton the bundle was created from |
2. Wrong package: doctrine/common instead of doctrine/collections
The only Doctrine\Common\* usage is Doctrine\Common\Collections\ArrayCollection (DoctrineProcessHandler), which belongs to doctrine/collections, not to doctrine/common.
3. Packages used directly but only installed transitively
| Package | Direct usage | Installed today by |
|---|---|---|
twig/twig |
src/Twig extensions (AbstractExtension, TwigFunction, TwigFilter, RuntimeExtensionInterface) |
easycorp/easyadmin-bundle |
symfony/twig-bundle |
Bundle templates, twig.extension tags, <twig:ui:…> components |
easycorp/easyadmin-bundle |
psr/log |
Psr\Log\LoggerInterface |
doctrine/orm, easycorp/easyadmin-bundle |
doctrine/persistence |
Doctrine\Persistence\ManagerRegistry |
doctrine/orm |
doctrine/migrations |
Doctrine\Migrations\AbstractMigration (all migrations) |
doctrine/doctrine-migrations-bundle |
symfony/event-dispatcher-contracts |
Symfony\Contracts\EventDispatcher |
symfony/event-dispatcher |
twig/extra-bundle (require-dev) |
TwigExtraBundle in tests/App/TestKernel.php |
easycorp/easyadmin-bundle |
Monolog (also used directly, only installed through cleverage/process-bundle) is handled separately in #150, as it is a prerequisite of cleverage/process-bundle#269.
The other requirements are used (e.g. symfony/expression-language by Assert\When, see #125; symfony/doctrine-messenger for the doctrine://default transport prepended by the extension; symfony/notifier stays optional: suggest + require-dev, guarded by interface_exists()).
Proposed fix
- Remove
symfony/dotenv,symfony/runtime,ext-ctypeandext-iconvfromrequire, andsymfony/runtimefromconfig.allow-plugins(unless the test setup needs them, then move them torequire-dev). - Replace
doctrine/commonbydoctrine/collections(^2.2 || ^3, the range ofdoctrine/orm). - Require the packages of table 3, with the lower bounds already imposed by their current providers (e.g.
twig/twig^3.24 || ^4,doctrine/persistence^3.3.1 || ^4,doctrine/migrations^3.2,psr/log^1 || ^2 || ^3,symfony/event-dispatcher-contracts^3, Symfony packages^6.4 || ^7.4 || ^8). - CHANGELOG entry noting that applications must require
symfony/dotenv/symfony/runtimethemselves (the Symfony skeleton already does).
Note: once both process-bundle (#281) and this bundle are released without symfony/dotenv / symfony/runtime, an application that does not require them itself loses vendor/autoload_runtime.php (bin/console, public/index.php) and Dotenv. The demo requires them since cleverage/process-bundle-demo#81 (PR cleverage/process-bundle-demo#82).
Requirements
- Documentation updates
- Reference
- Cookbooks
- Changelog
- Unit tests
Breaking changes
None for the bundle API. Minor: applications relying on the bundle to install symfony/dotenv or symfony/runtime transitively must require them.
Activity
[-]Composer: remove the unused symfony/dotenv, symfony/runtime, ext-ctype and ext-iconv requirements[/-][+]Composer: remove unused requirements, replace doctrine/common by doctrine/collections, declare the packages used directly[/+]njoubert-cleverage commentedon Oct 14, 2026
Also found during the dependency check of all the bundles:
symfony/property-accessis used intests/Entity/LogRecordTest.phpbut not required (installed through other packages): add it torequire-dev. (symfony/twig-bundle, used by theTestKernel, is already in the table above;symfony/monolog-bundleis handled in #150.)Merge pull request #153 from cleverage/149