PHP code example of sopheos / pebble_security

1. Go to this page and download the library: Download sopheos/pebble_security 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/ */

    

sopheos / pebble_security example snippets


use Pebble\Security\JWT;

$jwt = JWT::encode(['sub' => 42, 'exp' => time() + 3600], $secret, JWT::HS256);
$payload = JWT::decode($jwt, $secret, true, JWT::HS256);

use Pebble\Security\JWT;
use Pebble\Security\Token;

$jwt = (new Token('https://api.example', $secret, JWT::HS256, $deviceId))
    ->add('user', 42)
    ->generate(3600);

$token = (new Token('https://api.example', $secret, JWT::HS256, $deviceId))->import($header);
$userId = $token->get('user');
bash
cp -r vendor/sopheos/pebble_security/skills/pebble-security .claude/skills/pebble-security