Skip to content

Commit e93b922

Browse files
committed
Merge branch '5.2' into 5.3
* 5.2: Clarifying how to autowire scoped HTTP clients
2 parents a4d7c9f + e7aa1f1 commit e93b922

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

http_client.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ autoconfigure the HTTP client based on the requested URL:
215215
http_client:
216216
scoped_clients:
217217
# only requests matching scope will use these options
218-
github:
218+
github.client:
219219
scope: 'https://api\.github\.com'
220220
headers:
221221
Accept: 'application/vnd.github.v3+json'
@@ -224,7 +224,7 @@ autoconfigure the HTTP client based on the requested URL:
224224
225225
# using base_uri, relative URLs (e.g. request("GET", "/repos/symfony/symfony-docs"))
226226
# will default to these options
227-
github:
227+
github.client:
228228
base_uri: 'https://api.github.com'
229229
headers:
230230
Accept: 'application/vnd.github.v3+json'
@@ -245,7 +245,7 @@ autoconfigure the HTTP client based on the requested URL:
245245
<framework:config>
246246
<framework:http-client>
247247
<!-- only requests matching scope will use these options -->
248-
<framework:scoped-client name="github"
248+
<framework:scoped-client name="github.client"
249249
scope="https://api\.github\.com"
250250
>
251251
<framework:header name="Accept">application/vnd.github.v3+json</framework:header>
@@ -254,7 +254,7 @@ autoconfigure the HTTP client based on the requested URL:
254254
255255
<!-- using base-uri, relative URLs (e.g. request("GET", "/repos/symfony/symfony-docs"))
256256
will default to these options -->
257-
<framework:scoped-client name="github"
257+
<framework:scoped-client name="github.client"
258258
base-uri="https://api.github.com"
259259
>
260260
<framework:header name="Accept">application/vnd.github.v3+json</framework:header>
@@ -271,7 +271,7 @@ autoconfigure the HTTP client based on the requested URL:
271271
272272
return static function (FrameworkConfig $framework) {
273273
// only requests matching scope will use these options
274-
$framework->httpClient()->scopedClient('github')
274+
$framework->httpClient()->scopedClient('github.client')
275275
->scope('https://api\.github\.com')
276276
->header('Accept', 'application/vnd.github.v3+json')
277277
->header('Authorization', 'token %env(GITHUB_API_TOKEN)%')
@@ -280,7 +280,7 @@ autoconfigure the HTTP client based on the requested URL:
280280
281281
// using base_url, relative URLs (e.g. request("GET", "/repos/symfony/symfony-docs"))
282282
// will default to these options
283-
$framework->httpClient()->scopedClient('github')
283+
$framework->httpClient()->scopedClient('github.client')
284284
->baseUri('https://api.github.com')
285285
->header('Accept', 'application/vnd.github.v3+json')
286286
->header('Authorization', 'token %env(GITHUB_API_TOKEN)%')
@@ -323,8 +323,8 @@ Each client has a unique service named after its configuration.
323323

324324
Each scoped client also defines a corresponding named autowiring alias.
325325
If you use for example
326-
``Symfony\Contracts\HttpClient\HttpClientInterface $myApiClient``
327-
as the type and name of an argument, autowiring will inject the ``my_api.client``
326+
``Symfony\Contracts\HttpClient\HttpClientInterface $githubClient``
327+
as the type and name of an argument, autowiring will inject the ``github.client``
328328
service into your autowired classes.
329329

330330
.. note::

0 commit comments

Comments
 (0)