custom.php 744 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. require_once '../vendor/autoload.php';
  3. use chillerlan\QRCode\QRCode;
  4. use chillerlan\QRCode\Output\QROutputAbstract;
  5. /**
  6. * Class MyCustomOutput
  7. */
  8. class MyCustomOutput extends QROutputAbstract{
  9. /**
  10. * @return mixed
  11. * @throws \chillerlan\QRCode\Output\QRCodeOutputException
  12. */
  13. public function dump(){
  14. $output = '';
  15. for($row = 0; $row < $this->pixelCount; $row++){
  16. for($col = 0; $col < $this->pixelCount; $col++){
  17. $output .= (string)(int)$this->matrix[$row][$col];
  18. }
  19. }
  20. return $output;
  21. }
  22. }
  23. $starttime = microtime(true);
  24. echo (new QRCode('otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net', new MyCustomOutput))->output();
  25. echo PHP_EOL.'QRCode: '.round((microtime(true)-$starttime), 5);