pi-qo / token-generator
Package to generate cryptographically secure tokens in PHP.
v1.0.1
2020-08-10 12:47 UTC
Requires
- php: ^7.2
This package is auto-updated.
Last update: 2024-10-10 21:48:12 UTC
README
Package to generate cryptographically correct tokens in PHP.
Usage
It is pretty simple to use this tiny library. The first thing to do is to include Composer autoloader.
require_once __DIR__ . '/vendor/autoload.php'; use PiQo\Token;
Then the token is generated when the class is instanciated. The default length is 32 bytes, you can use the one you want by providing it to the constructor.
$generated = new Token(64); $token = $generated->getHex(); // Human readable $token = $generated->getRaw(); // for the raw generated token