File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -443,9 +443,21 @@ method takes an instance of
443
443
You can clear a cookie via the
444
444
:method: `Symfony\\ Component\\ HttpFoundation\\ ResponseHeaderBag::clearCookie ` method.
445
445
446
- Note you can create a
447
- :class: `Symfony\\ Component\\ HttpFoundation\\ Cookie ` object from a raw header
448
- value using :method: `Symfony\\ Component\\ HttpFoundation\\ Cookie::fromString `.
446
+ In addition to the ``Cookie::create() `` method, you can create a ``Cookie ``
447
+ object from a raw header value using :method: `Symfony\\ Component\\ HttpFoundation\\ Cookie::fromString `.
448
+ You can also use the ``with*() `` methods to change some Cookie property (or to
449
+ build the entire Cookie using a fluent interface). Each ``with*() `` method returns
450
+ a new object with the modified property::
451
+
452
+ $cookie = Cookie::create('foo')
453
+ ->withValue('bar')
454
+ ->withExpiresTime(strtotime('Fri, 20-May-2011 15:25:52 GMT'))
455
+ ->withDomain('.example.com')
456
+ ->withSecure(true);
457
+
458
+ .. versionadded :: 5.1
459
+
460
+ The ``with*() `` methods were introduced in Symfony 5.1.
449
461
450
462
Managing the HTTP Cache
451
463
~~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments