API-QRCode.md.txt 7.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # QRCode
  2. The full phpDocumentor API documentation can be found at [chillerlan.github.io/php-qrcode](https://chillerlan.github.io/php-qrcode/classes/chillerlan-QRCode-QRCode.html).
  3. ## Methods
  4. <!-- using non-breaking spaces chr(255) in the longest method signature to force the silly table to stretch -->
  5. | method | return | description |
  6. |-----------------------------------------------------------|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  7. | `__construct(SettingsContainerInterface $options = null)` | - | see [`QROptions`](./API-QROptions.md) and [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/main/src/SettingsContainerInterface.php) |
  8. | `setOptions(SettingsContainerInterface $options)` | `self` | Sets an options instance, internally called via the constructor |
  9. | `render(string $data, string $file = null)` | `mixed` | renders a QR Code for the given `$data` and `QROptions`, saves `$file` optionally, output depends on the chosen mode, see `QROutputInterface::dump()` |
  10. | `renderMatrix(QRMatrix $matrix, string $file = null)` | `mixed` | renders a QR Code for the given `QRMatrix` and `QROptions`, saves `$file` optionally, output depends on the chosen mode, see `QROutputInterface::dump()` |
  11. | `getQRMatrix()` | `QRMatrix` | returns a `QRMatrix` object for the given `$data` and current `QROptions` |
  12. | `addSegment(QRDataModeInterface $segment)` | `self` | Adds a `QRDataModeInterface` segment |
  13. | `clearSegments()` | `self` | Clears the data segments array |
  14. | `addNumericSegment(string $data)` | `self` | Adds a numeric data segment |
  15. | `addAlphaNumSegment(string $data)` | `self` | Adds an alphanumeric data segment |
  16. | `addKanjiSegment(string $data)` | `self` | Adds a Kanji data segment (Japanese 13-bit double-byte characters, Shift-JIS) |
  17. | `addHanziSegment(string $data)` | `self` | Adds a Hanzi data segment (simplified Chinese 13-bit double-byte characters, GB2312/GB18030) |
  18. | `addByteSegment(string $data)` | `self` | Adds an 8-bit byte data segment |
  19. | `addEciDesignator(int $encoding)` | `self` | Adds a standalone ECI designator |
  20. | `addEciSegment(int $encoding, string $data)` | `self` | Adds an ECI data segment (including designator) |
  21. | `readFromFile(string $path)` | `DecoderResult` | Reads a QR Code from a given file |
  22. | `readFromBlob(string $blob)` | `DecoderResult` | Reads a QR Code from the given data blob |
  23. | `readFromSource(LuminanceSourceInterface $source)` | `DecoderResult` | Reads a QR Code from the given luminance source |
  24. ### Deprecated methods
  25. | method | since | replacement |
  26. |------------------------------|---------|--------------------------------------------|
  27. | `getMatrix()` | `5.0.0` | `QRCode::getQRMatrix()` |
  28. | `isNumber(string $string)` | `5.0.0` | `Number::validateString(string $string)` |
  29. | `isAlphaNum(string $string)` | `5.0.0` | `AlphaNum::validateString(string $string)` |
  30. | `isKanji(string $string)` | `5.0.0` | `Kanji::validateString(string $string)` |
  31. | `isByte(string $string)` | `5.0.0` | `Byte::validateString(string $string)` |
  32. ## Constants
  33. ### Deprecated constants
  34. | name | since | replacement |
  35. |----------------------|---------|----------------------------------|
  36. | `VERSION_AUTO` | `5.0.0` | `Version::AUTO` |
  37. | `MASK_PATTERN_AUTO` | `5.0.0` | `MaskPattern::AUTO` |
  38. | `OUTPUT_MARKUP_SVG` | `5.0.0` | `QROutputInterface::MARKUP_SVG` |
  39. | `OUTPUT_MARKUP_HTML` | `5.0.0` | `QROutputInterface::MARKUP_HTML` |
  40. | `OUTPUT_IMAGE_PNG` | `5.0.0` | `QROutputInterface::GDIMAGE_PNG` |
  41. | `OUTPUT_IMAGE_JPG` | `5.0.0` | `QROutputInterface::GDIMAGE_JPG` |
  42. | `OUTPUT_IMAGE_GIF` | `5.0.0` | `QROutputInterface::GDIMAGE_GIF` |
  43. | `OUTPUT_STRING_JSON` | `5.0.0` | `QROutputInterface::STRING_JSON` |
  44. | `OUTPUT_STRING_TEXT` | `5.0.0` | `QROutputInterface::STRING_TEXT` |
  45. | `OUTPUT_IMAGICK` | `5.0.0` | `QROutputInterface::IMAGICK` |
  46. | `OUTPUT_FPDF` | `5.0.0` | `QROutputInterface::FPDF` |
  47. | `OUTPUT_CUSTOM` | `5.0.0` | `QROutputInterface::CUSTOM` |
  48. | `ECC_L` | `5.0.0` | `EccLevel::L` |
  49. | `ECC_M` | `5.0.0` | `EccLevel::M` |
  50. | `ECC_Q` | `5.0.0` | `EccLevel::Q` |
  51. | `ECC_H` | `5.0.0` | `EccLevel::H` |
  52. | `DATA_NUMBER` | `5.0.0` | `Mode::NUMBER` |
  53. | `DATA_ALPHANUM` | `5.0.0` | `Mode::ALPHANUM` |
  54. | `DATA_BYTE` | `5.0.0` | `Mode::BYTE` |
  55. | `DATA_KANJI` | `5.0.0` | `Mode::KANJI` |