soatok / wp-paseto
PASETO v4.local implementation that supports PHP 5.6+ (for WordPress projects)
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/soatok/wp-paseto
Requires
- php: >= 5.6
- ext-json: *
- paragonie/sodium_compat: ^1|^2
Requires (Dev)
- phpunit/phpunit: >= 5
- vimeo/psalm: >= 1
This package is auto-updated.
Last update: 2025-10-21 05:02:33 UTC
README
Requirements:
- PHP 5.6 or newer
Recommended:
- PHP 7.2 or newer
- Sodium extension
Supports key rotation. Implements v4.local. only!
Installing
composer require soatok/wp-paseto
Usage
Provide an array of key id strings mapped to hex-encoded keys to the constructor.
Then you can encode() and decode() arrays containing arbitrary claims.
<?php // Define your keys $encoder = new WP_Paseto(( 'key-id-1' => 'hex-encoded 256-bit (32 byte) random key goes here', 'key-id-2' => 'hex-encoded 256-bit (32 byte) random key goes here', // ... 'key-id-N' =>L 'hex-encoded 256-bit (32 byte) random key goes here' )); // Encode a secret $token = $encoder->encode(array('secret' => 'value goes here')); var_dump($token); /* v4.local.fHvh8jwJauiNMdC0yRZ9xvbCE5cdrNwP4... */ // Decode $claims = $encoder->decode($token);