Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shiwildy/phptotp

A simple TOTP library for PHP
https://github.com/shiwildy/phptotp

auth authenticator googleauth mfa mfa-authenticator multiauth phptotp totp twa two-factor-authentication

Last synced: 6 days ago
JSON representation

A simple TOTP library for PHP

Awesome Lists containing this project

README

        

# PHPTOTP
A simple TOTP library for PHP

## Installation
```bash
composer require shiwildy/phptotp
```

## Example
```php
getSecret();
echo "Secret Key: " . $secret . PHP_EOL;

// Generate Current auth code
$auth = $phptotp->getAuth($secret);
echo "Current Auth Code:" . $auth . PHP_EOL;

// Verify Auth code with secret key
$verify = $phptotp->verify($auth, $secret);
if ($verify === true) {
echo "Verify status: Correct" . PHP_EOL;
} else {
echo "Verify status: Incorrect" . PHP_EOL;
}

// Generate TOTP Link
$qrcodelink = $phptotp->getQRCodeUrl("[email protected]", "MyApp", $secret);
echo "Importable Link for QR: " . $qrcodelink . PHP_EOL;
?>
```

## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.

## License
This project licensed under The MIT License