secure = ENVIRONMENT === 'production'; if ($this->secure) { $this->prefix = '__Host-'; } } /** * -------------------------------------------------------------------------- * Cookie HTTPOnly * -------------------------------------------------------------------------- * * Cookie will only be accessible via HTTP(S) (no JavaScript). */ public bool $httponly = true; /** * -------------------------------------------------------------------------- * Cookie SameSite * -------------------------------------------------------------------------- * * Configure cookie SameSite setting. Allowed values are: * - None * - Lax * - Strict * - '' * * Alternatively, you can use the constant names: * - `Cookie::SAMESITE_NONE` * - `Cookie::SAMESITE_LAX` * - `Cookie::SAMESITE_STRICT` * * Defaults to `Lax` for compatibility with modern browsers. Setting `''` * (empty string) means default SameSite attribute set by browsers (`Lax`) * will be set on cookies. If set to `None`, `$secure` must also be set. * * @phpstan-var 'None'|'Lax'|'Strict'|'' */ public string $samesite = 'Lax'; /** * -------------------------------------------------------------------------- * Cookie Raw * -------------------------------------------------------------------------- * * This flag allows setting a "raw" cookie, i.e., its name and value are * not URL encoded using `rawurlencode()`. * * If this is set to `true`, cookie names should be compliant of RFC 2616's * list of allowed characters. * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes * @see https://tools.ietf.org/html/rfc2616#section-2.2 */ public bool $raw = false; }