mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-21 23:53:11 +00:00
28 lines
624 B
PHP
28 lines
624 B
PHP
<?php
|
|
/**
|
|
*
|
|
* @filesource authenticator.php
|
|
* @created 10.11.2017
|
|
* @author Smiley <smiley@chillerlan.net>
|
|
* @copyright 2017 Smiley
|
|
* @license MIT
|
|
*/
|
|
|
|
require_once '../vendor/autoload.php';
|
|
|
|
use chillerlan\{
|
|
GoogleAuth\Authenticator,
|
|
QRCode\QRCode,
|
|
QRCode\Output\QRMarkup
|
|
};
|
|
|
|
$authenticator = new Authenticator;
|
|
|
|
$secret = $authenticator->createSecret(); // -> userdata
|
|
$data = $authenticator->getUri($secret, 'label', 'example.com');
|
|
|
|
// markup - svg
|
|
echo '<!DOCTYPE html><html><head><meta charset="UTF-8"/></head><body><div>'.(new QRCode($data, new QRMarkup))->output().'</div></body>';
|
|
|
|
|