@@ -25,6 +25,7 @@ Discovery is simply a convenience wrapper to statically access clients and facto
25
25
Dependency Injection is not an option. Discovery is useful in libraries that want to offer
26
26
zero-configuration services relying on the virtual packages.
27
27
28
+ .. _discovery-strategies :
28
29
29
30
Strategies
30
31
----------
@@ -84,23 +85,56 @@ Read more about setting up Puli in their `official documentation`_.
84
85
Common Errors
85
86
-------------
86
87
88
+ Could not find resource using any discovery strategy
89
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90
+
91
+ If you get an error saying "*Could not find resource using any discovery strategy. *"
92
+ it means that all the discovery :ref: `strategies <discovery-strategies >` have failed.
93
+ Most likely, your project is missing the message factories and/or a PRS-7 implementation.
94
+ See the :doc: `user documentation <httplug/users >`.
95
+
96
+ To resolve this you may run
97
+
98
+ .. code-block :: bash
99
+
100
+ $ composer require php-http/curl-client guzzlehttp/psr7 php-http/message
101
+
87
102
Puli Factory is not available
88
103
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89
104
90
- If you get an error that says "*Puli Factory is not available *", it means that you have failed to install Puli.
91
- You should make sure you install the latest version of ``puli/composer-plugin ``.
105
+ If you get an error that says "*Puli Factory is not available *", it means that you
106
+ have failed to install Puli. Using Puli is optional and you will be able to use
107
+ common clients and message factories without Puli (:doc: `see how <httplug/users >`).
108
+ If you want to use Puli, make sure to install the latest version of
109
+ ``puli/composer-plugin ``.
110
+
111
+ .. code-block :: bash
112
+
113
+ $ composer require puli/composer-plugin
92
114
93
115
No factories found
94
116
^^^^^^^^^^^^^^^^^^
95
117
96
- The error "*No factories found. To use Guzzle or Diactoros factories install php-http/message and the chosen message implementation. *"
97
- tells you that Puli could not find an installed implementation of PSR-7 and/or factories to that implementation. You
98
- need to install those libraries. If you want to use Guzzle you may run:
118
+ The error "*No message factories found. To use Guzzle, Diactoros or Slim Framework
119
+ factories install php-http/message and the chosen message implementation. *" tells
120
+ you that no discovery strategy could find an installed implementation of PSR-7
121
+ and/or factories for that implementation. You need to install those libraries.
122
+ If you want to use Guzzle you may run:
99
123
100
124
.. code-block :: bash
101
125
102
126
$ composer require php-http/message guzzlehttp/psr7
103
127
128
+ No HTTPlug clients found
129
+ ^^^^^^^^^^^^^^^^^^^^^^^^
130
+
131
+ The error "*No HTTPlug clients found. Make sure to install a package providing
132
+ 'php-http/client-implementation' *" says that we cannot find a client. See our
133
+ :doc: `list of clients <clients >` and install one of them.
134
+
135
+ .. code-block :: bash
136
+
137
+ $ composer require php-http/curl-client
104
138
105
139
HTTP Client Discovery
106
140
---------------------
@@ -118,7 +152,7 @@ This type of discovery finds an HTTP Client implementation::
118
152
protected $httpClient;
119
153
120
154
/**
121
- * @param HttpClient|null $httpClient Client to do HTTP requests, if not set, autodiscovery will be used to find a HTTP client.
155
+ * @param HttpClient|null $httpClient Client to do HTTP requests, if not set, auto discovery will be used to find a HTTP client.
122
156
*/
123
157
public function __construct(HttpClient $httpClient = null)
124
158
{
@@ -142,7 +176,7 @@ This type of discovery finds a HTTP asynchronous Client implementation::
142
176
protected $httpAsyncClient;
143
177
144
178
/**
145
- * @param HttpAsyncClient|null $httpAsyncClient Client to do HTTP requests, if not set, autodiscovery will be used to find an asynchronous client.
179
+ * @param HttpAsyncClient|null $httpAsyncClient Client to do HTTP requests, if not set, auto discovery will be used to find an asynchronous client.
146
180
*/
147
181
public function __construct(HttpAsyncClient $httpAsyncClient = null)
148
182
{
0 commit comments