8000 minor #18274 Remove mentions of httplug's factories (nicolas-grekas) · symfony/symfony-docs@5779723 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5779723

Browse files
committed
minor #18274 Remove mentions of httplug's factories (nicolas-grekas)
This PR was merged into the 6.3 branch. Discussion ---------- Remove mentions of httplug's factories See symfony/recipes#1194 Commits ------- 24f8c0f Remove mentions of httplug's factories
2 parents d118afa + 24f8c0f commit 5779723

File tree

1 file changed

+3
-40
lines changed

1 file changed

+3
-40
lines changed

http_client.rst

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,47 +1619,10 @@ The `HTTPlug`_ v1 specification was published before PSR-18 and is superseded by
16191619
it. As such, you should not use it in newly written code. The component is still
16201620
interoperable with libraries that require it thanks to the
16211621
:class:`Symfony\\Component\\HttpClient\\HttplugClient` class. Similarly to
1622-
:class:`Symfony\\Component\\HttpClient\\Psr18Client` implementing relevant parts of PSR-17,
1623-
``HttplugClient`` also implements the factory methods defined in the related
1624-
``php-http/message-factory`` package.
1622+
:class:`Symfony\\Component\\HttpClient\\Psr18Client`, ``HttplugClient`` also
1623+
implements relevant parts of PSR-17.
16251624

1626-
.. code-block:: terminal
1627-
1628-
# Let's suppose php-http/httplug is already required by the lib you want to use
1629-
1630-
# installs an efficient implementation of response and stream factories
1631-
# with autowiring aliases provided by Symfony Flex
1632-
$ composer require nyholm/psr7
1633-
1634-
# alternatively, install the php-http/discovery package to auto-discover
1635-
# any already installed implementations from common vendors:
1636-
# composer require php-http/discovery
1637-
1638-
Let's say you want to instantiate a class with the following constructor,
1639-
that requires HTTPlug dependencies::
1640-
1641-
use Http\Client\HttpClient;
1642-
use Http\Message\RequestFactory;
1643-
use Http\Message\StreamFactory;
1644-
1645-
class SomeSdk
1646-
{
1647-
public function __construct(
1648-
HttpClient $httpClient,
1649-
RequestFactory $requestFactory,
1650-
StreamFactory $streamFactory
1651-
)
1652-
// [...]
1653-
}
1654-
1655-
Because ``HttplugClient`` implements the three interfaces, you can use it this way::
1656-
1657-
use Symfony\Component\HttpClient\HttplugClient;
1658-
1659-
$httpClient = new HttplugClient();
1660-
$apiClient = new SomeSdk($httpClient, $httpClient, $httpClient);
1661-
1662-
If you'd like to work with promises, ``HttplugClient`` also implements the
1625+
If you'd like to work with promises, ``HttplugClient`` implements the
16631626
``HttpAsyncClient`` interface. To use it, you need to install the
16641627
``guzzlehttp/promises`` package:
16651628

0 commit comments

Comments
 (0)
0