Oihana PHP Enums

CookieSameSite uses ConstantsTrait

Enumeration of `SameSite` cookie attribute values.

The SameSite attribute of a Set-Cookie header controls whether the cookie is sent with cross-site requests, mitigating CSRF and some cross-site tracking. Values are case-insensitive on the wire but the canonical capitalised form is kept here.

Example:

setcookie( 'sid' , $id , [ 'samesite' => CookieSameSite::LAX , 'secure' => true ] ) ;
Tags
see
HttpHeader::SET_COOKIE
https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis
author

Marc Alcaraz (ekameleon)

since
1.1.0

Table of Contents

Constants

LAX  : string = 'Lax'
`Lax` — Cookie sent on same-site requests and top-level cross-site navigations.
NONE  : string = 'None'
`None` — Cookie sent on all requests; requires the `Secure` attribute.
STRICT  : string = 'Strict'
`Strict` — Cookie sent only for same-site requests.

Constants

LAX

`Lax` — Cookie sent on same-site requests and top-level cross-site navigations.

public string LAX = 'Lax'

NONE

`None` — Cookie sent on all requests; requires the `Secure` attribute.

public string NONE = 'None'

STRICT

`Strict` — Cookie sent only for same-site requests.

public string STRICT = 'Strict'
On this page

Search results