Download the PHP package tourze/wechat-work-external-contact-bundle without Composer
On this page you can find all versions of the php package tourze/wechat-work-external-contact-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package wechat-work-external-contact-bundle
WeChat Work External Contact Bundle
中文
Table of Contents
- Overview
- Features
- Installation
- Configuration
- Dependencies
- Usage
- Advanced Usage
- Events
- Commands
- Entities
- Testing
- License
Overview
WeChat Work External Contact management bundle for Symfony applications. This bundle provides comprehensive management capabilities for external contacts (customers) in WeChat Work ecosystem including synchronization, event handling, and automated processing.
Features
- External contact (customer) management
- External contact list synchronization
- Welcome message sending for new contacts
- Avatar downloading and storage
- OpenID conversion for payment integration
- Event-driven architecture with Symfony Messenger
- Audit logging for external API interactions
- Cron job automation for background tasks
Installation
Configuration
The bundle uses automatic service configuration. Add the bundle to your config/bundles.php:
Dependencies
Required Dependencies
- PHP >= 8.1
- Symfony >= 6.4
- Doctrine ORM >= 3.0
- WeChat Work Bundle >= 0.1
- Carbon >= 2.72
- League Flysystem >= 3.10
Dev Dependencies
- PHPUnit >= 10.0
- PHPStan >= 2.1
Usage
Commands
Sync External Contact List
Synchronizes the external contact list from WeChat Work API:
This command runs automatically via cron at 4:30 AM daily.
Check User Avatar
Downloads and stores external contact avatars:
This command runs automatically every 8 hours (at :25 minutes).
API Requests
The bundle provides several request classes for WeChat Work API:
Entities
ExternalUser
Represents an external contact (customer):
ExternalServiceRelation
Manages the relationship between internal users and external contacts:
Procedures
GetWechatWorkExternalUserDetail
JSON-RPC procedure to get external user details:
SaveWechatWorkExternalUser
JSON-RPC procedure to save external user data:
Events
GetExternalUserDetailEvent
Dispatched when external user details are requested:
Welcome Messages
Send welcome messages to new external contacts:
Advanced Usage
Custom Event Listeners
You can create custom event listeners to extend the bundle's functionality:
Extending Entities
Add custom fields to external contacts:
Message Queue Configuration
Configure Symfony Messenger for async processing:
Custom Commands
Create custom commands extending the base functionality:
Events
The bundle dispatches several events that you can listen to:
WechatWorkServerMessageRequestEvent
Triggered when a WeChat Work server message is received:
Commands
Available Commands
| Command | Description | Schedule |
|---|---|---|
wechat-work:sync-external-contact-list |
Sync external contact list | Daily 04:30 |
wechat-work:external-contact:check-user-avatar |
Download and store avatars | Every 8 hours |
Command Examples
Entities
ExternalUser
Main entity representing external contacts:
ExternalServiceRelation
Represents the relationship between internal users and external contacts:
Architecture
The bundle follows Symfony best practices:
- Commands: Console commands for batch operations
- Controllers: REST API endpoints
- Entities: Doctrine entities for data persistence
- Events: Event-driven communication
- Message Handlers: Async processing with Symfony Messenger
- Procedures: JSON-RPC procedures for internal APIs
- Repositories: Data access layer
- Requests: WeChat Work API request objects
Testing
Run the test suite:
The test suite includes:
- ✅ Unit Tests: 358 tests covering entities, requests, events, and messages
- ✅ PHPStan Analysis: Level 9 static analysis with zero errors
- ⚠️ Integration Tests: Temporarily disabled due to complex service dependencies
Note: Complex integration tests requiring HttpClientBundle\Service\SmartHttpClient are tracked in GitHub Issue #931. All unit tests and core functionality tests pass successfully (358/358 tests).
License
This bundle is part of the Tourze PHP Monorepo and follows the same license terms.
Documentation
For more information about WeChat Work External Contact API, see:
All versions of wechat-work-external-contact-bundle with dependencies
ext-mbstring Version *
doctrine/collections Version ^2.3
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^3.1 || ^4
league/flysystem Version ^3.10
nesbot/carbon Version ^2.72 || ^3
psr/log Version ^3|^2|^1
symfony/config Version ^6.4
symfony/console Version ^6.4
symfony/dependency-injection Version ^6.4
symfony/doctrine-bridge Version ^6.4
symfony/event-dispatcher Version ^6.4
symfony/event-dispatcher-contracts Version ^2.5 | ^3
symfony/framework-bundle Version ^6.4
symfony/http-client-contracts Version ^2.5 | ^3.0
symfony/http-foundation Version ^6.4
symfony/http-kernel Version ^6.4
symfony/messenger Version ^6.4
symfony/property-access Version ^6.4
symfony/routing Version ^6.4
symfony/security-core Version ^6.4
symfony/serializer Version ^6.4
symfony/yaml Version ^6.4 || ^7.1
tourze/arrayable Version 0.0.*
tourze/async-contracts Version 0.0.*
tourze/doctrine-indexed-bundle Version 0.0.*
tourze/doctrine-timestamp-bundle Version 0.0.*
tourze/easy-admin-attribute Version 0.1.*
tourze/http-client-bundle Version 0.1.*
tourze/json-rpc-core Version 0.0.*
tourze/json-rpc-lock-bundle Version 0.1.*
tourze/json-rpc-log-bundle Version 0.1.*
tourze/symfony-cron-job-bundle Version 0.1.*
tourze/text-manage-bundle Version 0.0.*
tourze/wechat-work-bundle Version 0.1.*
tourze/wechat-work-contracts Version 0.0.*
tourze/wechat-work-external-contact-model Version 0.0.*
tourze/wechat-work-server-bundle Version 0.0.*