composer / composer

Dependency Manager for PHP
https://getcomposer.org/
MIT License
28.4k stars 4.49k forks source link

Use a dependency injection container #8636

Open szepeviktor opened 4 years ago

szepeviktor commented 4 years ago

While developing a Composer plugin I very much feel the need of a DI container.

final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)

Passing all these arguments is very tedious and accessing one instance of a class from different places is not possible automatically.

Thank you for considering. Was #3803

@stof @Seldaek

Seldaek commented 4 years ago

Might be something for 3.0 but not before.

szepeviktor commented 4 years ago

🤣

stof commented 4 years ago

Also, what you are asking for is not a DI container (which supposes that your class still uses DI and so the constructor stays the same than today). It is more about asking for a service locator.

szepeviktor commented 4 years ago

a service locator.

Yes, you're right.