PHP code example of jsq / iron-php
1. Go to this page and download the library: Download jsq/iron-php 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/ */
jsq / iron-php example snippets
use Jsq\Iron;
use Jsq\Iron\Password;
// payloads can be anything that can be serialized by json_encode
$payload = ['an' => 'array'];
// passwords must be at least 32 characters long
$password = base64_encode(openssl_random_pseudo_bytes(24));
// tokens can be set to expire after a fixed number of seconds
$ttl = 300;
// create a sealed token
$token = Iron\seal($payload, $password, $ttl);
// The token will be unsealable with the correct password until the token expires
$unsealed = Iron\unseal($token, $password);
// Named passwords can also be used
$password = new Password(base64_encode(openssl_random_pseudo_bytes(24)), 'my_password');
// create a sealed token with the named password
$token = Iron\seal($payload, $password);
shell
$ composer