tourze/wechat-official-account-qrcode-bundle
Symfony bundle for generating WeChat Official Account QR codes. Create temporary and permanent QR codes with custom scene values, manage ticket lifecycles, and integrate QR-based campaigns, user tracking, and channel attribution into your PHP applications.
This is an early (0.0.1) Symfony bundle for generating WeChat Official Account QR codes, not a native Laravel package. It wraps the WeChat qrcode/create API to produce temporary or permanent QR codes used for login, binding, or channel attribution.
Minimal steps:
composer require tourze/wechat-official-account-qrcode-bundlesrc/Resources/config/services.yaml (or equivalent) and replicate bindings in a Laravel service provider. The bundle likely depends on tourze/wechat-official-account-bundle for access-token management—install and configure that first.app_id, app_secret, token, and aes_key (if using encrypted callbacks). In Symfony this lives under config/packages/wechat_official_account_qrcode.yaml; in Laravel you'll need to publish/copy that structure into config/wechat.php and bind values manually.createTemporaryQrCode($sceneInt, $expireSeconds). The response contains a ticket; build the scannable URL as https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=<urlencoded_ticket>.Where to look first: src/Service/ for the QR code generation class, src/DependencyInjection/ for config keys, and any tests for real usage examples. The README may be sparse at 0.0.1—rely on the source.
login_123, bind_456). Store the mapping scene -> user_id / purpose / created_at in your database so the callback handler can resolve it.SCAN (already followed) or subscribe (new follower) with EventKey containing the scene. Write a controller that parses the XML, extracts EventKey, looks up the scene, and updates your application state (e.g., mark login token as scanned).ContainerInterface or event dispatcher, provide Laravel-compatible implementations or use a bridge like symfony/console only where needed. Prefer constructor injection of the QR service into your own actions/jobs.tourze/wechat-official-account-bundle (or whatever it depends on) to fetch and cache the access token. Do not fetch tokens manually; WeChat rate-limits token requests and invalidates old tokens when a new one is issued.config publishing, no facade, no auto-discovery. Budget time to manually wire services and config. If you need a quick Laravel solution, consider laravel/socialite with a WeChat driver for login—but this bundle gives you finer control over QR scenes and permanent codes.simplexml_load_string with libxml_disable_entity_loader(true) for safety, or a dedicated parser. Log the raw XML during development.errcode, errmsg). Common errors: invalid scene (out of range), invalid access token, or rate limit exceeded.composer.json and review changelogs before upgrading. The API surface (method names, config keys) may change.How can I help you explore Laravel packages today?