tourze/wechat-mini-program-security-bundle
Symfony bundle that wires WeChat Mini Program content security checks into your PHP app, wrapping the msgSecCheck and mediaCheckAsync APIs so you can screen user text and images for policy violations with configurable credentials and service definitions.
Architecture fit
tourze/*-bundle naming, DI extension + Configuration tree), not a Laravel service provider. In a Laravel codebase it will not auto-register, will not read config/*.php, and will not resolve from the container without an adapter. The realistic integration is to bypass the bundle layer entirely and instantiate the underlying security client directly, or to write a thin ServiceProvider that maps Laravel config into the bundle's constructor arguments.access_token acquisition/caching. This is HTTP-plus-cache plumbing, not deep domain logic — which caps the value of the bundle abstraction and raises the cost/benefit of adopting a foreign framework's wiring conventions.errcode 40001). Whether that logic is portable to Laravel's cache contract is the single biggest architectural question.Integration feasibility
symfony/http-client and symfony/config alongside Laravel's existing HTTP stack, or (c) a fork. Option (b) adds a second HTTP client to the app for a single integration, which is hard to justify.Technical risk
0.2.x, semver permits breaking changes on minor bumps. 0.2.1 is a patch, so the probability of breakage is lower — but there is no deprecation policy to rely on, and no prior assessment in place to diff against.appid/secret and access_token must flow correctly; any implicit env-var or filesystem-cache assumption in the bundle needs auditing before production.Key questions
symfony/http-client into our stack?access_token caching pluggable (PSR-6/PSR-16) or hard-coded?easywechat) that is natively Laravel-friendly and better maintained?Stack fit
illuminate/http). The package will not "fit" out of the box; treat it as a library to be wrapped, not a drop-in.WeChatSecurityServiceProvider that binds a small interface (ContentSecurityChecker) to an implementation that delegates to the package's core client. Keep the package behind our own interface so it can be swapped or forked without touching call sites.Migration path
symfony/http-client, stop and switch to a direct Guzzle implementation.easywechat or a ~200-line direct client scoped as the alternative so the decision is reversible.Compatibility
composer.lock (Laravel ships several symfony/* components at pinned majors — a mismatched symfony/config is a realistic blocker).errcode sets have drifted historically).Sequencing
Maintenance
0.2.1, not ^0.2) and upgrade deliberately. At 0.x, floating constraints are unsafe.Support
access_token refresh failure, errcode interpretation table, and a rollback procedure to the fallback client.Scaling
access_token concurrency are the real constraints. Confirm the token cache is shared across app instances (Redis, not array/file cache) or the app will invalidate its own tokens under horizontal scale.Failure modes
access_token invalidation races — multiple workers refreshing concurrently, causing mutual invalidation. Mitigate with a lock around refresh.errcode mishandling — quota exceeded (45009) and token expiry (40001) require distinct retry policies; a generic retry will amplify rate-limit failures.Ramp-up
How can I help you explore Laravel packages today?