Skip to content

Composer: remove unused requirements, replace doctrine/common by doctrine/collections, declare the packages used directly #149

Closed

Description

@njoubert-cleverage

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-ctype and ext-iconv from require, and symfony/runtime from config.allow-plugins (unless the test setup needs them, then move them to require-dev).
  • Replace doctrine/common by doctrine/collections (^2.2 || ^3, the range of doctrine/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/runtime themselves (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

  1. changed the title [-]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[/+] on Oct 14, 2026
  2. njoubert-cleverage commented on Oct 14, 2026

    @njoubert-cleverage
    MemberAuthor

    Also found during the dependency check of all the bundles: symfony/property-access is used in tests/Entity/LogRecordTest.php but not required (installed through other packages): add it to require-dev. (symfony/twig-bundle, used by the TestKernel, is already in the table above; symfony/monolog-bundle is handled in #150.)

  3. added a commit that references this issue on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions