getExpirationTime

Learn how to get the time the token expires.

This method provides the time the token expires, expressed as a Unix timestamp in seconds. When the token does not expire, it returns null.

Signature

This method has the following signature:

public function getExpirationTime(): ?int

This method returns the expiration time as a Unix timestamp in seconds, or null when the token does not expire.

Example

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

<?phpuse Croct\Plug\Croct;
$croct = Croct::fromDotenv();$token = $croct->getUserToken();
$expirationTime = $token->getExpirationTime();