getName

Learn how to read the cookie name.

This method provides the name of the cookie.

Signature

This method has the following signature:

public function getName(): string

This method returns the name of the cookie.

Example

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

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