From 131d6ade5d3f71d96a6ab91ab82ff27a550900d4 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Wed, 13 Oct 2021 23:48:58 +0300 Subject: [PATCH] Add alternative to custom installers (#10149) Taken from composer/installers readme --- doc/articles/custom-installers.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/articles/custom-installers.md b/doc/articles/custom-installers.md index 9c0ee2b65..849b9f8f0 100644 --- a/doc/articles/custom-installers.md +++ b/doc/articles/custom-installers.md @@ -13,6 +13,16 @@ library. In these cases you could consider creating a Custom Installer to handle your specific logic. +## Alternative to custom installers with Composer 2.1+ + +As of Composer 2.1, the `Composer\InstalledVersions` class has a +[`getInstalledPackagesByType`](https://getcomposer.org/doc/07-runtime.md#knowing-which-packages-of-a-given-type-are-installed) +method which can let you figure out at runtime which plugins/modules/extensions are installed. + +It is highly recommended to use that instead of building new custom +installers if you are building a new application. This has the advantage of leaving +all vendor code in the vendor directory, and not requiring custom installer code. + ## Calling a Custom Installer Suppose that your project already has a Custom Installer for specific modules