base on A PHP QR Code generator and reader with a user-friendly API. # chillerlan/php-qrcode A PHP QR Code generator based on the [implementation by Kazuhiko Arase](https://github.com/kazuhikoarase/qrcode-generator), namespaced, cleaned up, improved and other stuff. <br> It also features a QR Code reader based on a [PHP port](https://github.com/khanamiryan/php-qrcode-detector-decoder) of the [ZXing library](https://github.com/zxing/zxing). **Attention:** there is now also a javascript port on NPM: [@chillerlan/qrcode](https://www.npmjs.com/package/@chillerlan/qrcode). [![PHP Version Support][php-badge]][php] [![Packagist version][packagist-badge]][packagist] [![Continuous Integration][gh-action-badge]][gh-action] [![CodeCov][coverage-badge]][coverage] [![Codacy][codacy-badge]][codacy] [![Packagist downloads][downloads-badge]][downloads] [![Documentation][readthedocs-badge]][readthedocs] [php-badge]: https://img.shields.io/packagist/php-v/chillerlan/php-qrcode?logo=php&color=8892BF&logoColor=fff [php]: https://www.php.net/supported-versions.php [packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-qrcode.svg?logo=packagist&logoColor=fff [packagist]: https://packagist.org/packages/chillerlan/php-qrcode [gh-action-badge]: https://img.shields.io/github/actions/workflow/status/chillerlan/php-qrcode/ci.yml?branch=main&logo=github&logoColor=fff [gh-action]: https://github.com/chillerlan/php-qrcode/actions/workflows/ci.yml?query=branch%3Amain [coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-qrcode/main?logo=codecov&logoColor=fff [coverage]: https://app.codecov.io/gh/chillerlan/php-qrcode/tree/main [codacy-badge]: https://img.shields.io/codacy/grade/edccfc4fe5a34b74b1c53ee03f097b8d/main?logo=codacy&logoColor=fff [codacy]: https://app.codacy.com/gh/chillerlan/php-qrcode/dashboard?branch=main [downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-qrcode?logo=packagist&logoColor=fff [downloads]: https://packagist.org/packages/chillerlan/php-qrcode/stats [readthedocs-badge]: https://img.shields.io/readthedocs/php-qrcode/main?logo=readthedocs&logoColor=fff [readthedocs]: https://php-qrcode.readthedocs.io/en/main/ # Overview ## Features - Creation of [Model 2 QR Codes](https://www.qrcode.com/en/codes/model12.html), [Version 1 to 40](https://www.qrcode.com/en/about/version.html) - [ECC Levels](https://www.qrcode.com/en/about/error_correction.html) L/M/Q/H supported - Mixed mode support (encoding modes can be combined within a QR symbol). Supported modes: - numeric - alphanumeric - 8-bit binary - [ECI support](https://en.wikipedia.org/wiki/Extended_Channel_Interpretation) - 13-bit double-byte: - kanji (Japanese, Shift-JIS) - hanzi (simplified Chinese, GB2312/GB18030) as [defined in GBT18284-2000](https://www.chinesestandard.net/PDF/English.aspx/GBT18284-2000) - Flexible, easily extensible output modules, built-in support for the following output formats: - [GdImage](https://www.php.net/manual/book.image) (raster graphics: avif, bmp, gif, jpeg, png, webp) - [ImageMagick](https://www.php.net/manual/book.imagick) ([multiple supported image formats](https://imagemagick.org/script/formats.php)) - Markup types: SVG, HTML, etc. - String types: JSON, plain text, etc. - Encapsulated Postscript (EPS) - PDF via [FPDF](https://github.com/setasign/fpdf) - QR Code reader (via GD and ImageMagick) ## Requirements - PHP 8.2+ - [`ext-mbstring`](https://www.php.net/manual/book.mbstring.php) - optional: - [`ext-gd`](https://www.php.net/manual/book.image) for `QRGdImage` based output - [`ext-imagick`](https://github.com/Imagick/imagick) with [ImageMagick](https://imagemagick.org) installed - [`ext-fileinfo`](https://www.php.net/manual/book.fileinfo.php) required by `QRImagick` output - [`setasign/fpdf`](https://github.com/setasign/fpdf) for the PDF output module - [`intervention/image`](https://github.com/Intervention/image) for alternative GD/ImageMagick output For the QR Code reader, either `ext-gd` or `ext-imagick` is required! # Documentation - The user manual is at https://php-qrcode.readthedocs.io/ ([sources](https://github.com/chillerlan/php-qrcode/tree/main/docs)) - An API documentation created with [phpDocumentor](https://www.phpdoc.org/) can be found at https://chillerlan.github.io/php-qrcode/ - The documentation for the `QROptions` container is here: [chillerlan/php-settings-container](https://github.com/chillerlan/php-settings-container#readme) - Benchmark results can be found in the [`benchmark` branch](https://github.com/chillerlan/php-qrcode/tree/benchmark/markdown) **Important: Please use the examples from the branch that matches your installed php-qrcode version ( [v4.x](https://github.com/chillerlan/php-qrcode/tree/v4.3.x/examples), [v5.x](https://github.com/chillerlan/php-qrcode/tree/v5.0.x/examples), [dev-main](https://github.com/chillerlan/php-qrcode/tree/main/examples) )!**<br/> The `main` (default) branch is the active development for future major versions, and it is most likely incompatible with the latest release versions. ## Installation with [composer](https://getcomposer.org) See [the installation guide](https://php-qrcode.readthedocs.io/en/main/Usage/Installation.html) for more info! ### Terminal ``` composer require chillerlan/php-qrcode ``` ### composer.json ```json { "require": { "php": "^8.2", "chillerlan/php-qrcode": "dev-main#<commit_hash>" } } ``` Note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^5.0` - see [releases](https://github.com/chillerlan/php-qrcode/releases) for valid versions. ## Quickstart We want to encode this URI for a mobile authenticator into a QRcode image: ```php $data = 'otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net'; // quick and simple: echo '<img src="'.(new QRCode)->render($data).'" alt="QR Code" />'; ``` Wait, what was that? Please again, slower! See [Advanced usage](https://php-qrcode.readthedocs.io/en/main/Usage/Advanced-usage.html) in the manual. Also, have a look [in the examples folder](https://github.com/chillerlan/php-qrcode/tree/main/examples) for some more usage examples. <p align="center"> <img alt="QR codes are awesome!" style="width: auto; height: 530px;" src="https://raw.githubusercontent.com/chillerlan/php-qrcode/main/.github/images/example.svg"> </p> # Disclaimer! I don't take responsibility for molten CPUs, misled applications, failed log-ins etc.. Use at your own risk! ## License notice - Parts of this code are [ported to PHP](https://github.com/codemasher/php-qrcode-decoder) from the [ZXing project](https://github.com/zxing/zxing) and licensed under the [Apache License, Version 2.0](./NOTICE). - [The documentation](https://github.com/chillerlan/php-qrcode/tree/main/docs) is licensed under the [Creative Commons Attribution 4.0 International (CC BY 4.0) License](https://creativecommons.org/licenses/by/4.0/). ## Trademark Notice The word "QR Code" is a registered trademark of *DENSO WAVE INCORPORATED*<br> https://www.qrcode.com/en/faq.html#patentH2Title ", Assign "at most 3 tags" to the expected json: {"id":"1844","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"