PHP code example of kiwfy / jwt-manager-php
1. Go to this page and download the library: Download kiwfy/jwt-manager-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/ */
kiwfy / jwt-manager-php example snippets
use JwtManager\JwtManager;
$secret = '77682b9441bb7daa7a1fa6eb7522b689';
$context = 'test';
$expire = 30;
$renew = 10;
$jwtManager = new JwtManager(
$secret,
$context,
$expire,
$renew
);
$tokenGenerated = $jwtManager->generate('test');
var_dump($tokenGenerated);
$result = $jwtManager->decodePayload($tokenGenerated);
var_dump($result);
$result = $jwtManager->isValid($tokenGenerated);
var_dump($result);
$result = $jwtManager->isOnTime($tokenGenerated);
var_dump($result);
$result = $jwtManager->getexpire($tokenGenerated);
var_dump($result);
$result = $jwtManager->tokenNeedToRefresh($tokenGenerated);
var_dump($result);
sh
docker build --build-arg PHP_VERSION=8.4-cli -t not-empty/jwt-manager-php-lib:php84 -f contrib/Dockerfile .
sh
docker run --name jwt-manager-php-lib -v ${PWD}/:/var/www/html -it not-empty/jwt-manager-php-lib:php84 bash
sh
php sample/jwt-manager-sample.php
sh
docker build --build-arg PHP_VERSION=8.4-cli -t not-empty/jwt-manager-php-lib:php84 -f contrib/Dockerfile .
sh
docker run --name jwt-manager-php-lib -v ${PWD}/:/var/www/html -it not-empty/jwt-manager-php-lib:php84 bash