EncryptCookies
class EncryptCookies
Properties
| protected array<int, string> | $except | The names of the cookies that should not be encrypted. |
|
| static protected array<int, string> | $neverEncrypt | The globally ignored cookies that should not be encrypted. |
|
| static protected array<int, string> | $onlyEncrypt | The cookies that should be encrypted (opt-in mode). |
|
| static protected bool | $serialize | Indicates if cookies should be serialized. |
Methods
Disable encryption for the given cookie name(s).
Validate and remove the cookie value prefix from the value.
Validate and remove the cookie value prefix from all values of an array.
Decrypt the given cookie and return the value.
Decrypt an array based cookie.
Encrypt the cookies on an outgoing response.
Duplicate a cookie with a new value.
Determine whether encryption has been disabled for the given cookie.
Indicate that the given cookies should never be encrypted.
Indicate that only the given cookies should be encrypted.
Determine if the cookie contents should be serialized.
Flush all static state.
Details
at line 50
__construct(Encrypter $encrypter)
Create a new middleware instance.
at line 61
void
disableFor(array|string $name)
Disable encryption for the given cookie name(s).
Boot-only. The list persists for the worker's lifetime and applies to every subsequent request.
at line 101
protected array|string|null
validateValue(string $key, array|string $value)
Validate and remove the cookie value prefix from the value.
at line 111
protected array
validateArray(string $key, array $value)
Validate and remove the cookie value prefix from all values of an array.
at line 125
protected array|string
decryptCookie(string $name, array|string $cookie)
Decrypt the given cookie and return the value.
at line 135
protected array
decryptArray(array $cookie)
Decrypt an array based cookie.
at line 155
protected Response
encrypt(Response $response)
Encrypt the cookies on an outgoing response.
at line 177
protected Cookie
duplicate(Cookie $cookie, mixed $value)
Duplicate a cookie with a new value.
at line 185
bool
isDisabled(string $name)
Determine whether encryption has been disabled for the given cookie.
at line 200
static void
except(array|string $cookies)
Indicate that the given cookies should never be encrypted.
Boot-only. The list persists in a static property for the worker lifetime and applies to every subsequent request.
at line 216
static void
only(array|string $cookies)
Indicate that only the given cookies should be encrypted.
When set, all other cookies pass through unencrypted. Takes precedence over except() and the $except property.
Boot-only. The list persists in a static property for the worker lifetime and applies to every subsequent request.
at line 226
static bool
serialized(string $name)
Determine if the cookie contents should be serialized.
at line 234
static void
flushState()
Flush all static state.