Http Cookies
Provides very simple DTOs for Http Cookie. These DTOs do not offer any "advanced" capabilities to send Http Cookie headers, nor to be populated from a Request / Response objects, or from Cookie
Http headers. They are nothing more than data placeholders. Feel free to extend them with whatever logic your application might require.
Examples
<?php
use Aedart\Http\Cookies\Cookie;
$cookie = new Cookie([
'name' => 'my_cookie',
'value' => 'sweet'
]);
<?php
use Aedart\Http\Cookies\SetCookie;
$cookie = new SetCookie([
'name' => 'my_cookie',
'value' => 'sweet',
'maxAge' => 60 * 5,
'secure' => true
]);
Motivation
At the time of this writing, when searching for packages that contain the keyword "cookie", there seems to be an abundance of vendors. Many of them appear to have "cookie" objects with all kinds of behavioural or creational logic, each serving their respectful purpose. Unfortunately, it can be difficult to reuse some of those packages, without introducing various side-effects, such as additional behavioural logic that might not be favourable in certain circumstances.
For the above mentioned reason, this package was created, in hopes to offer only the data-placeholder aspects for Http Cookies. How you choose to use these, is entirely up to you.