Simple tokens

1.1.0 2023-01-03 13:25 UTC

This package is auto-updated.

Last update: 2024-11-30 01:57:47 UTC


README

Germania KG ยท Token

Simple tokens

Packagist PHP version Tests

Installation

$ composer install germania-kg/token

Interface TokenInterface

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;
}

Class AuthToken

<?php
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

Testing

$ composer phpunit