Skip to content

Commit 8abb042

Browse files
Nyholmdbu
authored andcommitted
Added more common errors (#165)
Added more common errors to discovery documentation
1 parent 8ca71b5 commit 8abb042

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

discovery.rst

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Discovery is simply a convenience wrapper to statically access clients and facto
2525
Dependency Injection is not an option. Discovery is useful in libraries that want to offer
2626
zero-configuration services relying on the virtual packages.
2727

28+
.. _discovery-strategies:
2829

2930
Strategies
3031
----------
@@ -84,23 +85,56 @@ Read more about setting up Puli in their `official documentation`_.
8485
Common Errors
8586
-------------
8687

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+
87102
Puli Factory is not available
88103
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89104

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
92114
93115
No factories found
94116
^^^^^^^^^^^^^^^^^^
95117

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:
99123

100124
.. code-block:: bash
101125
102126
$ composer require php-http/message guzzlehttp/psr7
103127
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
104138
105139
HTTP Client Discovery
106140
---------------------
@@ -118,7 +152,7 @@ This type of discovery finds an HTTP Client implementation::
118152
protected $httpClient;
119153

120154
/**
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.
122156
*/
123157
public function __construct(HttpClient $httpClient = null)
124158
{
@@ -142,7 +176,7 @@ This type of discovery finds a HTTP asynchronous Client implementation::
142176
protected $httpAsyncClient;
143177

144178
/**
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.
146180
*/
147181
public function __construct(HttpAsyncClient $httpAsyncClient = null)
148182
{

0 commit comments

Comments
 (0)