isHttpOnly

Learn how to check whether the cookie is hidden from client-side scripts.

This method reports whether the cookie is hidden from client-side scripts.

Signature

This method has the following signature:

public function isHttpOnly(): bool

This method returns true when the cookie is hidden from client-side scripts, and false otherwise.

Example

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

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