# isAnonymous

Learn how to check whether the token is anonymous.

This method reports whether the token represents an anonymous visitor. The token is anonymous until you identify the visitor.

## Signature

This method has the following signature:

```php
public function isAnonymous(): bool
```

This method returns `true` when the token has no subject, and `false` otherwise.

## Example

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

```php
<?php
use Croct\Plug\Croct;

$croct = Croct::fromDotenv();
$token = $croct->getUserToken();

if (!$token->isAnonymous()) {
    $userId = $token->getSubject();
}
```
