{"id":16897789,"url":"https://github.com/endroid/qr-code-bundle","last_synced_at":"2025-05-14T13:05:49.184Z","repository":{"id":43756561,"uuid":"112526483","full_name":"endroid/qr-code-bundle","owner":"endroid","description":"Bundle for generating QR codes in Symfony","archived":false,"fork":false,"pushed_at":"2024-10-21T23:32:07.000Z","size":257,"stargazers_count":304,"open_issues_count":3,"forks_count":39,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-11T19:42:16.933Z","etag":null,"topics":["bundle","code","endroid","factory","flex","qr","qrcode","symfony","twig"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/endroid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"endroid"}},"created_at":"2017-11-29T20:51:25.000Z","updated_at":"2025-05-09T23:08:50.000Z","dependencies_parsed_at":"2024-11-13T16:41:08.530Z","dependency_job_id":"11871e54-db32-4446-b131-05efdbcd9a00","html_url":"https://github.com/endroid/qr-code-bundle","commit_stats":{"total_commits":159,"total_committers":15,"mean_commits":10.6,"dds":0.1823899371069182,"last_synced_commit":"a98e5ebb92db217a68f2a24f4916cb0cebae8f5a"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fqr-code-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fqr-code-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fqr-code-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fqr-code-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endroid","download_url":"https://codeload.github.com/endroid/qr-code-bundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149919,"owners_count":22022851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","code","endroid","factory","flex","qr","qrcode","symfony","twig"],"created_at":"2024-10-13T17:39:47.424Z","updated_at":"2025-05-14T13:05:49.161Z","avatar_url":"https://github.com/endroid.png","language":"PHP","readme":"# QR Code Bundle\r\n\r\n*By [endroid](https://endroid.nl/)*\r\n\r\n[![Latest Stable Version](http://img.shields.io/packagist/v/endroid/qr-code-bundle.svg)](https://packagist.org/packages/endroid/qr-code-bundle)\r\n[![Build Status](https://github.com/endroid/qr-code-bundle/workflows/CI/badge.svg)](https://github.com/endroid/qr-code-bundle/actions)\r\n[![Total Downloads](http://img.shields.io/packagist/dt/endroid/qr-code-bundle.svg)](https://packagist.org/packages/endroid/qr-code-bundle)\r\n[![Monthly Downloads](http://img.shields.io/packagist/dm/endroid/qr-code-bundle.svg)](https://packagist.org/packages/endroid/qr-code-bundle)\r\n[![License](http://img.shields.io/packagist/l/endroid/qr-code-bundle.svg)](https://packagist.org/packages/endroid/qr-code-bundle)\r\n\r\nThis Symfony bundle lets you generate QR Codes using the [endroid/qr-code](https://github.com/endroid/QrCode)\r\nlibrary. It provides the following features:\r\n\r\n* Configure your defaults (like image size, default writer etc.)\r\n* Support for multiple configurations and injection via aliases\r\n* Generate QR codes for defined configurations via URL like /qr-code/\u003cconfig\u003e/Hello\r\n* Generate QR codes or URLs directly from Twig using dedicated functions\r\n\r\n## Installation\r\n\r\nUse [Composer](https://getcomposer.org/) to install the library. Also make sure you have enabled and configured the\r\n[GD extension](https://www.php.net/manual/en/book.image.php) if you want to generate images.\r\n\r\n``` bash\r\ncomposer require endroid/qr-code-bundle\r\n```\r\n\r\nWhen you use Symfony, the [installer](https://github.com/endroid/installer)\r\nmakes sure that services are automatically wired. If this is not the case you\r\ncan find the configuration files in the `.install/symfony` folder.\r\n\r\nIf you don't want the installer to create the auto-configuration files, it can\r\nbe disabled as described [here](https://github.com/endroid/installer#configuration).\r\n\r\n## Configuration\r\n\r\nThe bundle makes use of builders to create QR codes. The default parameters\r\napplied by the builder can optionally be overridden via the configuration. and\r\nmultiple configurations (thus builders) can be defined.\r\n\r\n```yaml\r\nendroid_qr_code:\r\n    default:\r\n        writer: Endroid\\QrCode\\Writer\\PngWriter\r\n        data: 'This is customized QR code'\r\n        # Label is not implemented for SvgWriter\r\n        label_text: 'This is the label'\r\n        label_font_path: '%kernel.project_dir%/vendor/endroid/qr-code/assets/noto_sans.otf'\r\n        label_font_size: 20\r\n        label_alignment: 'center'\r\n    custom:\r\n        writer: Endroid\\QrCode\\Writer\\SvgWriter\r\n        writer_options:\r\n            exclude_xml_declaration: true # default: false\r\n        data: 'This is customized QR code'\r\n        size: 300\r\n        encoding: 'UTF-8'\r\n        error_correction_level: 'low' # 'low', 'medium', 'quartile', or 'high'\r\n        round_block_size_mode: 'margin'\r\n        logo_path: '%kernel.project_dir%/vendor/endroid/qr-code/tests/assets/symfony.png'\r\n        logo_resize_to_width: 150\r\n        logo_punchout_background: true\r\n        validate_result: false\r\n```\r\n\r\n## Using builders\r\n\r\nEach configuration results in a builder which can be injected in your classes.\r\nFor instance the custom builder from the example above can be injected like this\r\nand you can override the default configuration as follows.\r\n\r\n```php\r\nuse Endroid\\QrCode\\Builder\\BuilderInterface;\r\n\r\npublic function __construct(BuilderInterface $customQrCodeBuilder)\r\n{\r\n    $result = $customQrCodeBuilder-\u003ebuild(\r\n        size: 400,\r\n        margin: 20\r\n    );\r\n}\r\n```\r\n\r\n## QR Code Response\r\n\r\nThe bundle also provides a response object to ease rendering of the resulting\r\nimage by automatically saving to contents and setting the correct content type.\r\n\r\n```php\r\nuse Endroid\\QrCodeBundle\\Response\\QrCodeResponse;\r\n\r\n$response = new QrCodeResponse($result);\r\n```\r\n\r\n## Generate via URL\r\n\r\nThe bundle provides a controller that allows you to generate QR codes simply\r\nby opening an URL like /qr-code/{builder}/{data}. You can configure the prefix\r\nin your routing file and pass any of the existing options via query string.\r\n\r\n## Generate via Twig\r\n\r\nThe bundle provides a Twig extension for generating a QR code URL, path or data\r\nURI. You can use the second argument to specify the builder to use.\r\n\r\n```twig\r\n\u003cimg src=\"{{ qr_code_path('My QR Code') }}\" /\u003e\r\n\u003cimg src=\"{{ qr_code_url('My QR Code') }}\" /\u003e\r\n\u003cimg src=\"{{ qr_code_data_uri('My QR Code') }}\" /\u003e\r\n\r\n{# You can specify the builder via the second parameter #}\r\n\u003cimg src=\"{{ qr_code_data_uri('My QR Code', 'custom') }}\" /\u003e\r\n\r\n{# You can access the width and height via the matrix #}\r\n{% set qrCode = qr_code_result('My QR Code') %}\r\n\u003cimg src=\"{{ qrCode.dataUri }}\" width=\"{{ qrCode.matrix.outerSize }}\" /\u003e\r\n```\r\n    \r\n## Versioning\r\n\r\nVersion numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility\r\nbreaking changes will be kept to a minimum but be aware that these can occur.\r\nLock your dependencies for production and test your code when upgrading.\r\n\r\n## License\r\n\r\nThis source code is subject to the MIT license bundled in the file LICENSE.\r\n","funding_links":["https://github.com/sponsors/endroid"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendroid%2Fqr-code-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendroid%2Fqr-code-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendroid%2Fqr-code-bundle/lists"}