tourze/wechat-work-external-contact-stats-bundle
A Symfony bundle that integrates WeChat Work (企业微信) external contact statistics into your PHP application, letting you retrieve and expose metrics about external contacts and their interactions.
This is a very early release (0.0.1) of tourze/wechat-work-external-contact-stats-bundle — treat it as a preview, not something to drop into a production Laravel app without a spike first.
composer require tourze/wechat-work-external-contact-stats-bundle:^0.0.1. Expect Doctrine ORM, a PSR HTTP client, and one or more tourze/wechat-work-* sibling packages to come along as transitive dependencies.-bundle suffix and the tourze namespace strongly suggest a Symfony bundle (Bundle class, DI extension, Doctrine entities/repositories), not a Laravel package. Before writing any app code, open composer.json and look for symfony/framework-bundle, doctrine/orm, and whether a *Bundle.php class exists. There is very likely no ServiceProvider, no config/*.php publishable config, and no facade.src/ for the Bundle class, Entity/, Repository/, Command/, and any DependencyInjection/ config tree — the DI config is the real "documentation" for this package at 0.0.1.Resources/config/doctrine mapping), since you will need equivalent tables in your Laravel database.externalcontact/get_follow_user_list and externalcontact/get_user_behavior style stats calls.php artisan tinker / test script and dumping the raw response before wiring persistence.Because the package is framework-coupled to Symfony/Doctrine, the realistic patterns for a Laravel codebase are either bridge or wrap.
Bridge (Symfony bundle inside Laravel):
StatsServiceProvider — re-declare the classes you need with $this->app->bind() and pass config (corp ID, secret, agent ID) from config/services.php.Command classes, don't expect them under php artisan; either port the logic into an Artisan command or invoke via Artisan::call on a thin wrapper.Scheduled ingestion (the core workflow):
->dailyAt() / ->hourly() schedule, keyed by stat_date + userid + corp_id for idempotent upserts (updateOrCreate or upsert on a unique index).json column). At 0.0.1 the parsing shape is unproven; raw payloads let you re-derive numbers without re-hitting the rate-limited API.Integration tips:
ExternalContactStats service interface so the package is swappable — high probability you outgrow a 0.0.1 dependency.stats_sync_runs table with status and error text for observability."0.0.1", not ^0.0.1) and expect breaking changes on every bump. Review the diff before upgrading; there is no changelog beyond the commit list.Http::withToken() if the bundle only saves you a few DTOs.DependencyInjection/Configuration.php (or equivalent) for required config keys — corp ID, secret, agent ID, and any cache/token adapter are the usual suspects.userid values that no longer exist after staff turnover (handle gracefully, don't 500 the job), and stats that lag — "today" is usually incomplete, so schedule the definitive pull after midnight with a re-check window.stat_date as a plain date and keep timestamps in UTC to avoid off-by-one-day reporting bugs.How can I help you explore Laravel packages today?