isSecure

Learn how to check whether the cookie is sent only over HTTPS.

This method reports whether the cookie is sent only over HTTPS.

Signature

This method has the following signature:

public function isSecure(): bool

This method returns true when the cookie is sent only over HTTPS, and false otherwise.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\CookieStorage;
$cookies = CookieStorage::fromGlobals()->getResponseCookies();$secure = $cookies[0]->isSecure();