public function encode(string $iss, string $aud, string $sub, string $expires = null, array $claims = []): string
    {
        $now = new DateTimeImmutable();

        $claims = array_merge($claims, [
            'iss' => $iss,
            'aud' => $aud,
            'sub' => $sub,
            'iat' => $now->getTimestamp(),
            'exp' => $this->expires($now, $expires)
        ]);

        return FirebaseJWT::encode($claims, $this->privateKey, self::ALGO);
    }
public function encode(string $iss, string $aud, string $sub, string $expires = null, array $claims = []): string
    {
        $now = new DateTimeImmutable();

        $claims = array_merge($claims, [
            'iss' => $iss,
            'aud' => $aud,
            'sub' => $sub,
            'iat' => $now->getTimestamp(),
            'exp' => $this->expires($now, $expires)
        ]);

        return FirebaseJWT::encode($claims, $this->privateKey, self::ALGO);
    }
public function encode ( string $ iss , string $ aud , string $ sub , string $ expires = null , array $ claims = [ ] ) : string { $ now = new DateTimeImmutable ( ) ; $ claims = array_merge ( $ claims , [ 'iss' => $ iss , 'aud' => $ aud , 'sub' => $ sub , 'iat' => $ now -> getTimestamp ( ) , 'exp' => $ this -> expires ( $ now , $ expires ) ] ) ; return FirebaseJWT :: encode ( $ claims , $ this -> privateKey , self :: ALGO ) ; }
Generate JWT Token using private key

@param string $iss Issuer
@param string $aud Audition
@param string $sub Subject
@param string|null $expires Expiration constraint (example: + 10 days)
@param array $claims Public claims (example: ['user_id' => 10])
@return string Returns JWT token as string
@throws Exception
Generate JWT Token using private key