I recently read \"RFC 6265\" on the attribute \"Same Site\", I looked at some articles that talked about that in April 2016, \"same-site\" attribute has been implemented for
I wrote a class for setting samesite cookies.
https://github.com/ovunctukenmez/SameSiteCookieSetter
It works on all PHP versions. It also checks if the browser supports samesite parameter properly.
Here is the usage:
//set samesite strict php cookie
SameSiteCookieSetter::setcookie('samesite_test','testvalue', array('samesite' => 'Strict'));