TODO: Make `SameSite` Cookie Available Across PHP Version(s)
taufik-nurrohman opened this issue · comments
Use header()
function instead of setcookie()
function for compatibility with PHP versions older than 7.3.0:
// Set a same-site cookie for first-party contexts
header('Set-Cookie: cookie1=value1; SameSite=Lax', false);
// Set a cross-site cookie for third-party contexts
header('Set-Cookie: cookie2=value2; SameSite=None; Secure', false);