PHP code example of germania-kg / token
1. Go to this page and download the library: Download germania-kg/token 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/ */
germania-kg / token example snippets
interface TokenInterface
{
// Alias for "getContent"
public function __toString();
// Returns the token "text".
public function getContent() : string;
// Returns the lifetime in seconds.
public function getLifeTime() : int;
}
use Germania\Token\Token;
// Pass token string and TTL
$auth_token = new Token( "somerandomstring", 3600);
echo $auth_token; // "somerandomstring"
echo $auth_token->__toString(); // "somerandomstring"
echo $auth_token->getContent(); // "somerandomstring"
echo $auth_token->getLifeTime(); // 3600