dev-master
9999999-dev http://www.crazyawesomecompany.com/API Token creator and validator
BSD-3-Clause
The Requires
- php >=5.3.3
- ext-mcrypt *
The Development Requires
api security token
Wallogit.com
2017 © Pedro Peláez
API Token creator and validator
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)
API Token creator and validator
BSD-3-Clause
api security token