class EncryptCookies extends EncryptCookies (View source)

Middleware responsible for encrypting and decrypting cookies.

This middleware ensures that all cookies are automatically encrypted before being sent to the browser and decrypted when received by the application.

However, some cookies may need to remain unencrypted — for example, when handled by third-party services or authentication mechanisms such as JWT-based authentication.

Properties

protected array<int,string> $except

The names of cookies that should not be encrypted.

Methods

__construct()

Create a new EncryptCookies middleware instance.

Details

__construct()

Create a new EncryptCookies middleware instance.

The cookie names are resolved at runtime using the application configuration, since PHP does not allow function calls (such as config()) in property default values.