verify($key, $algo) && !$this->isExpired(); } /** * Checks whether the token is expired based on the 'exp' value. *it. * * @return bool */ public function isExpired() { $payload = $this->getPayload(); if (isset($payload['exp'])) { $now = new \DateTime('now'); if (is_int($payload['exp'])) { return ($now->getTimestamp() - $payload['exp']) > 0; } if (is_numeric($payload['exp'])) { return ($now->format('U') - $payload['exp']) > 0; } } return false; } }