Got it. I will post a working code for the new version. The key from twitch has to decoded.
function validate_twitch_jwt($jwt) {
$secretKey = base64_decode("YOUR_KEY_FROM_TWITCH");
try {
$decoded = JWT::decode($jwt, new Key($secretKey, 'HS256'));
return true;
} catch (Exception $e) {
$output['error'] = 'J An Error Occured';
$output['error'] = $e->getMessage();
echo json_encode($output);
}
}