CookieStorage
Learn how to persist the visitor session in cookies.
The cookie-based implementation of IdentityStore, persisting the visitor session, such as the client ID and user token, in cookies.
It is the default session store the SDK creates from the environment. You can also create one explicitly to customize the cookies, provide it when you create the SDK, then write the updated cookies before sending any output.
When you do not want to read or write cookies, such as in tests, use an in-memory store instead. It exposes the same interface but keeps the client ID and user token in memory.
Looking for something specific?
Use the search bar at the top of the page or press / to quickly search through the documentation.
Use the summary below to quickly jump to a specific topic:
| Page | Description |
|---|---|
| Constructor | Learn how to initialize a cookie storage directly. |
| fromGlobals | Learn how to create a storage from the PHP superglobals. |
| fromServerRequest | Learn how to create a storage from a PSR-7 server request. |
| fromArray | Learn how to create a storage from an array of cookies. |
| getResponseCookies | Learn how to get the session cookies to write to the response. |
| emit | Learn how to write the session cookies to the response. |