getSameSite

Learn how to read the cookie SameSite policy.

This method provides the SameSite policy of the cookie.

Signature

This method has the following signature:

public function getSameSite(): ?string

This method returns the SameSite policy of the cookie, or null when it is unset.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\CookieStorage;
$cookies = CookieStorage::fromGlobals()->getResponseCookies();$sameSite = $cookies[0]->getSameSite();