File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -1440,6 +1440,27 @@ Now you can make HTTP requests with the PSR-18 client as follows:
1440
1440
1441
1441
$content = json_decode($response->getBody()->getContents(), true);
1442
1442
1443
+ You can also pass a set of default options to your client thanks to the
1444
+ ``Psr18Client::withOptions() `` method::
1445
+
1446
+ use Symfony\Component\HttpClient\Psr18Client;
1447
+
1448
+ $client = (new Psr18Client())
1449
+ ->withOptions([
1450
+ 'base_uri' => 'https://symfony.com',
1451
+ 'headers' => [
1452
+ 'Accept' => 'application/json',
1453
+ ],
1454
+ ]);
1455
+
1456
+ $request = $client->createRequest('GET', '/versions.json');
1457
+
1458
+ // ...
1459
+
1460
+ .. versionadded :: 6.2
1461
+
1462
+ The ``Psr18Client::withOptions() `` method was introduced in Symfony 6.2.
1463
+
1443
1464
HTTPlug
1444
1465
~~~~~~~
1445
1466
@@ -1528,6 +1549,24 @@ Then you're ready to go::
1528
1549
// wait for all remaining promises to resolve
1529
1550
$httpClient->wait();
1530
1551
1552
+ You can also pass a set of default options to your client thanks to the
1553
+ ``HttplugClient::withOptions() `` method::
1554
+
1555
+ use Psr\Http\Message\ResponseInterface;
1556
+ use Symfony\Component\HttpClient\HttplugClient;
1557
+
1558
+ $httpClient = (new HttplugClient())
1559
+ ->withOptions([
1560
+ 'base_uri' => 'https://my.api.com',
1561
+ ]);
1562
+ $request = $httpClient->createRequest('GET', '/');
1563
+
1564
+ // ...
1565
+
1566
+ .. versionadded :: 6.2
1567
+
1568
+ The ``HttplugClient::withOptions() `` method was introduced in Symfony 6.2.
1569
+
1531
1570
Native PHP Streams
1532
1571
~~~~~~~~~~~~~~~~~~
1533
1572
Original file line number Diff line number Diff line change @@ -123,6 +123,25 @@ Parameter Description
123
123
``{{ value }} `` The current (invalid) value
124
124
================= ============================================================
125
125
126
+ exactly
127
+ ~~~~~~~
128
+
129
+ **type **: ``integer ``
130
+
131
+ This option is the exact length value. Validation will fail if
132
+ the given value's length is not **exactly ** equal to this value.
133
+
134
+ .. note ::
135
+
136
+ This option is the one being set by default when using the Length constraint
137
+ without passing any named argument to it. This means that for example,
138
+ ``@Assert\Length(20) `` and ``@Assert\Length(exactly=20) `` are equivalent, as
139
+ well as ``#[Assert\Length(20)] `` and ``#[Assert\Length(exactly: 20)] ``.
140
+
141
+ .. versionadded :: 5.2
142
+
143
+ The named argument ``exactly `` was introduced in Symfony 5.2.
144
+
126
145
exactMessage
127
146
~~~~~~~~~~~~
128
147
You can’t perform that action at this time.
0 commit comments