text.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * @created 21.12.2017
  4. * @author Smiley <smiley@chillerlan.net>
  5. * @copyright 2017 Smiley
  6. * @license MIT
  7. */
  8. use chillerlan\QRCode\{QRCode, QROptions};
  9. use chillerlan\QRCode\Data\QRMatrix;
  10. require_once __DIR__.'/../vendor/autoload.php';
  11. $options = new QROptions([
  12. 'version' => 5,
  13. 'outputType' => QRCode::OUTPUT_STRING_TEXT,
  14. 'eccLevel' => QRCode::ECC_L,
  15. 'moduleValues' => [
  16. // finder
  17. (QRMatrix::M_FINDER << 8) => 'A', // dark (true)
  18. (QRMatrix::M_FINDER_DOT << 8) => 'A', // dark (true)
  19. QRMatrix::M_FINDER => 'a', // light (false)
  20. // alignment
  21. (QRMatrix::M_ALIGNMENT << 8) => 'B',
  22. QRMatrix::M_ALIGNMENT => 'b',
  23. // timing
  24. (QRMatrix::M_TIMING << 8) => 'C',
  25. QRMatrix::M_TIMING => 'c',
  26. // format
  27. (QRMatrix::M_FORMAT << 8) => 'D',
  28. QRMatrix::M_FORMAT => 'd',
  29. // version
  30. (QRMatrix::M_VERSION << 8) => 'E',
  31. QRMatrix::M_VERSION => 'e',
  32. // data
  33. (QRMatrix::M_DATA << 8) => 'F',
  34. QRMatrix::M_DATA => 'f',
  35. // darkmodule
  36. (QRMatrix::M_DARKMODULE << 8) => 'G',
  37. // separator
  38. QRMatrix::M_SEPARATOR => 'h',
  39. // quietzone
  40. QRMatrix::M_QUIETZONE => 'x',
  41. ],
  42. ]);
  43. // <pre> to view it in a browser
  44. $qrcode = (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
  45. echo '<pre style="line-height: 1;">'.$qrcode.'</pre>';