PHP code example of aetah / jose

1. Go to this page and download the library: Download aetah/jose library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aetah / jose example snippets




declare(strict_types=1);

use Aetah\JOSE\JOSE;

$jose = new JOSE();

$jwt = $jose->sign(
    claims: ['sub' => '123', 'iss' => 'https://issuer.example'],
    algorithm: 'HS256',
    privateKey: 'shared-secret',
    kid: 'sig-1'
);

$parsed = $jose->verifyWithKey($jwt, 'shared-secret');

$keys = $jose->parsePublicRsaJwks(
    json: $jwksDocument,
    allowedAlgorithms: ['RS256']
);
bash
composer analyse
bash
composer clean