A token can be parsed from a string and transformed into a LittleApps\LittleJWT\JWT\JWT
instance. If the token cannot be parsed, parseToken()
will return null
. This means the token could not be parsed, not that it couldn't be validated. More information the JWT instance can be found in The JWT documentation.
use LittleApps\LittleJWT\Facades\LittleJWT;
$token = "...";
$jwt = LittleJWT::parseToken($token);
if (! is_null($jwt)) {
// The JWT was parsed.
// This does NOT mean the JWT is valid.
} else {
// The JWT wasn't parsed.
}