time() + $exp, ]; // SameSite none and secure will be required for tools to work inside iframes $sameSiteOptions = [ 'samesite' => 'None', 'secure' => false, 'httponly' => true, ]; setcookie($name, $value, array_merge($cookieOptions, $sameSiteOptions, $options)); // Set a second fallback cookie in the event that "SameSite" is not supported setcookie("LEGACY_".$name, $value, array_merge($cookieOptions, $options)); return $this; } }