ds / authenticate
Authentication Library
Installs: 273
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Forks: 0
pkg:composer/ds/authenticate
Requires (Dev)
- phpunit/phpunit: ^9
This package is not auto-updated.
Last update: 2025-09-27 17:41:46 UTC
README
Authentication Classes
Token
$token = new \Ds\Authenticate\Token();
$randomToken = $token->create();
var_dump($randomToken);
$stringToken = $token->createFromString('this is a test','privateKey');
var_dump($stringToken);
Password
$password = new \Ds\Authenticate\Password();
$examplePassword = 'password';
$hashedExamplePassword = $password->hash($examplePassword,PASSWORD_DEFAULT);
var_dump($hashedExamplePassword);
try{
$verified = $password->verify($examplePassword, $hashedExamplePassword);
$updatedPassword = $password->needsRehash($hashedExamplePassword);
if ($hashedExamplePassword !== $updatedPassword){
//save updated password
}
catch(\Exception $e){
//not authenticated...
}