Please look at the documentation. You will find it in the following link:
https://book.cakephp.org/3.0/en/controllers/request-response.html#Cake\Http\Cookie\CookieCollection
To create a cookie
use Cake\Http\Cookie\Cookie;
$cookie = new Cookie(
'remember_me', // name
1, // value
new DateTime('+1 year'), // expiration time, if applicable
'/', // path, if applicable
'example.com', // domain, if applicable
false, // secure only?
true // http only ? );
Now add the cookie in the cookie collection:
use Cake\Http\Cookie\CookieCollection;
$cookies = new CookieCollection([$cookie]);//To create new collection
$cookies = $cookies->add($cookie);//to add in existing collection
Now read cookie this way.
$cookie = $cookies->get('remember_me');
Hope you will find it's working.
Here should mention an important point: Cookie writing and reading must be two separate http request.