diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst
index 4cd6f938166..9d3b45048eb 100644
--- a/reference/configuration/framework.rst
+++ b/reference/configuration/framework.rst
@@ -751,16 +751,62 @@ as a service named ``http_client`` or using the autowiring alias
This service can be configured using ``framework.http_client.default_options``:
-.. code-block:: yaml
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/framework.yaml
+ framework:
+ # ...
+ http_client:
+ max_host_connections: 10
+ default_options:
+ headers: { 'X-Powered-By': 'ACME App' }
+ max_redirects: 7
+
+ .. code-block:: xml
+
+
+
+
- # config/packages/framework.yaml
- framework:
- # ...
- http_client:
- max_host_connections: 10
- default_options:
- headers: { 'X-Powered-By': 'ACME App' }
- max_redirects: 7
+
+
+
+ ACME App
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ $container->loadFromExtension('framework', [
+ 'http_client' => [
+ 'max_host_connections' => 10,
+ 'default_options' => [
+ 'headers' => [
+ 'X-Powered-By' => 'ACME App',
+ ],
+ 'max_redirects' => 7,
+ ],
+ ],
+ ]);
+
+ .. code-block:: php-standalone
+
+ $client = HttpClient::create([
+ 'headers' => [
+ 'X-Powered-By' => 'ACME App',
+ ],
+ 'max_redirects' => 7,
+ ], 10);
.. _reference-http-client-scoped-clients:
@@ -769,16 +815,57 @@ service name defined as a key under ``scoped_clients``. Scoped clients inherit
the default options defined for the ``http_client`` service. You can override
these options and can define a few others:
-.. code-block:: yaml
+.. configuration-block::
+
+ .. code-block:: yaml
- # config/packages/framework.yaml
- framework:
- # ...
- http_client:
- scoped_clients:
- my_api.client:
- auth_bearer: secret_bearer_token
- # ...
+ # config/packages/framework.yaml
+ framework:
+ # ...
+ http_client:
+ scoped_clients:
+ my_api.client:
+ auth_bearer: secret_bearer_token
+ # ...
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ $container->loadFromExtension('framework', [
+ 'http_client' => [
+ 'scoped_clients' => [
+ 'my_api.client' => [
+ 'auth_bearer' => 'secret_bearer_token',
+ // ...
+ ],
+ ],
+ ],
+ ]);
+
+ .. code-block:: php-standalone
+
+ $client = HttpClient::createForBaseUri('https://...', [
+ 'auth_bearer' => 'secret_bearer_token',
+ // ...
+ ]);
Options defined for scoped clients apply only to URLs that match either their
`base_uri`_ or the `scope`_ option when it is defined. Non-matching URLs always