src/Encoder.php

lcobucci/jwt · src/Encoder.php · php · BSD-3-Clause
auth

Interface for encoding data to JSON and base64url for JWTs.

// 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;

use Lcobucci\JWT\Encoding\CannotEncodeContent;
use NoDiscard;

interface Encoder
{
    /**
     * Encodes to JSON, validating the errors
     *
     * @return non-empty-string
     *
     * @throws CannotEncodeContent When something goes wrong while encoding.
     */
    #[NoDiscard]
    public function jsonEncode(mixed $data): string;

    /**
     * Encodes to base64url
     *
     * @link http://tools.ietf.org/html/rfc4648#section-5
     *
     * @return ($data is non-empty-string ? non-empty-string : string)
     */
    #[NoDiscard]
    public function base64UrlEncode(s

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key