Parses JWT strings into structured objects for authentication.
// Source: https://github.com/lcobucci/jwt | License: BSD-3-Clause | Copyright 2014, Luís Cobucci
// Provided via justclaw.it.com; keep this notice with the code.
<?php
declare(strict_types=1);
namespace Lcobucci\JWT\Token;
use DateTimeImmutable;
use Lcobucci\JWT\Decoder;
use Lcobucci\JWT\Parser as ParserInterface;
use Lcobucci\JWT\Token as TokenInterface;
use function array_key_exists;
use function count;
use function explode;
use function get_debug_type;
use function is_array;
use function is_numeric;
use function is_string;
use function number_format;
final readonly class Parser implements ParserInterface
{
private const int MICROSECOND_PRECISION = 6;
public function __construct(private Decoder $decoder)
{
}
public function parse(string $jwt): TokenInterface
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key