Closed harikt closed 9 years ago
Yes, Cookies is on the request side (reading Cookies from the Request) and SetCookie is for the Response side. I hadn't finished fleshing out the SetCookie side yet so it probably isn't easy to follow. :)
Thanks for your help!
Hey @harikt, I'm going to hold off merging this and you might hold off making more changes to it. I totally appreciate it, but the final API might be a lot nicer. I'm currently working on some facades that will make working with this lower-level value objects easier.
For example:
$cookie = Cookie::create('lu', 'Rg3vHJZnehYLjVg7qi3bZjzg');
$request = FigCookies::setRequestCookie($request, $cookie);
... this will be shorthand for...
$cookie = Cookie::create('lu', 'Rg3vHJZnehYLjVg7qi3bZjzg');
Cookies::fromRequest($request)
->with($cookie)
->renderIntoCookieHeader($request)
;
... and...
$request = FigCookies::setRequestCookieFromStrings(
$request,
'lu',
'Rg3vHJZnehYLjVg7qi3bZjzg'
);
... to do without using any of the primitives all together.
sure @simensen .
Was away from keyboard. Internet outage and some other stuffs.
Thank you.
Hi @harikt, let me know what you think of the new README docs. I'm going to close this for now.
First quick look, looks good. Will come up with suggestions later.
Thank you.
Hi @simensen ,
I started to create some docs for the Readme. Somethings that came into my mind are
1 ) There is a Cookies class 2 ) Which contains collection of Cookie objects. 3 ) Now Cookies class have a method to convert them and attach to PSR 7 Requests. 4 ) There is a SetCookie class which have some what similarities with that of setcookie method of php.
May be the purpose of Cookies is just to read and
SetCookies
is what we need to make use of when we need to send to response ?Thank you