11Discovery
22=========
33
4- The discovery service allows to find and use installed resources.
5-
6- Consumers of libraries using discovery still need to make sure they install one of the implementations.
7- Discovery can only find installed code, not fetch code from other sources.
4+ The discovery service allows to find installed resources and install missing ones.
85
96Currently available discovery services:
107
@@ -28,6 +25,30 @@ Discovery is simply a convenience wrapper to statically access clients and facto
2825Dependency Injection is not an option. Discovery is useful in libraries that want to offer
2926zero-configuration services relying on the virtual packages.
3027
28+ Auto-installation
29+ -----------------
30+
31+ .. versionadded :: 1.15
32+ Auto-installation of missing dependencies is available since v1.15.
33+
34+ Discovery embeds a composer plugin that can auto-install missing implementations
35+ when an application does not specify any specific implementation.
36+
37+ If a library requires both ``php-http/discovery `` and one of the supported virtual packages
38+ (see :doc: `library-developers `), but no implementation for the virtual package is already
39+ installed, the plugin will auto-install the best matching known implementation.
40+
41+ For example, if one is using ``react/event-loop ``, the plugin will select ``php-http/react-adapter ``
42+ to meet a missing dependency on ``php-http/client-implementation ``.
43+
44+ The following abstractions are currently supported:
45+
46+ - ``php-http/async-client-implementation ``
47+ - ``php-http/client-implementation ``
48+ - ``psr/http-client-implementation ``
49+ - ``psr/http-factory-implementation ``
50+ - ``psr/http-message-implementation ``
51+
3152.. _discovery-strategies :
3253
3354Strategies
0 commit comments