2017 © Pedro Peláez
 

library api-token

API Token creator and validator

image

cac/api-token

API Token creator and validator

  • Sunday, April 28, 2013
  • by ngroot
  • Repository
  • 1 Watchers
  • 2 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Crazy Awesome API Token

Create and validate API tokens, (*1)

In this example we create a new token based on the user ID, (*2)

# ... user is logged in with user id 123
use CAC\Component\Token\Encrypt\McryptToken;
use CAC\Component\Token\TokenGenerator;

$tokenEncrypter = new McryptToken();
$tokenGenerator = new TokenGenerator($tokenEncrypter, 's3cr3tKeY$$');

$token = $tokenGenerator->createToken(123);

Get the user ID back from the token, (*3)

$userId = $tokenGenerator->validateToken($token);
# $userId = 123

When an invalid token is given the validateToken method returns FALSE, (*4)

The Versions

28/04 2013

dev-master

9999999-dev http://www.crazyawesomecompany.com/

API Token creator and validator

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.3
  • ext-mcrypt *

 

The Development Requires

api security token