siranta/phptoken

There is no license information available for the latest version (v1.1) of this package.

Librería para generar token

v1.1 2021-01-04 01:41 UTC

This package is auto-updated.

Last update: 2024-10-04 09:30:39 UTC


README

Installation

composer require siranta/phptoken

Create token

	use siranta\phptoken;
	
	$json = [
		"init" => time(),
		"exp" => time() + 60*10, // Token validity time
		"data" => [
			"id" => 12345678
		]
	];

	$key = "25d55ad283aa400af464c76d713c07ad"; // Private key
	$tt = new phptoken($json, $key);

	echo $tt->encode();

decrypt token

$token = new phptoken(TOKEN, KEY);
echo $token->decode();