Download the PHP package tourze/wechat-official-account-bundle without Composer
On this page you can find all versions of the php package tourze/wechat-official-account-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/wechat-official-account-bundle
More information about tourze/wechat-official-account-bundle
Files in tourze/wechat-official-account-bundle
Package wechat-official-account-bundle
Short Description 微信公众号基础能力支持,提供账号管理、消息处理等核心功能
License MIT
Informations about the package wechat-official-account-bundle
WeChat Official Account Bundle
中文
A comprehensive Symfony bundle for WeChat Official Account API integration. This bundle provides essential functionalities for managing WeChat Official Account operations including access token management, account configuration, and API requests with automatic token refresh and comprehensive error handling.
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Configuration
- Advanced Usage
- API Reference
- Testing
- Contributing
- Security
- License
Features
- Account Management: Store and manage multiple WeChat Official Account configurations
- Access Token Handling: Automatic access token refresh and caching with expiration management
- API Client: Pre-configured HTTP client for WeChat Official Account API requests
- Callback IP Management: Manage and validate callback IP addresses
- Doctrine Integration: Full ORM support with repositories and entities
- Symfony Bundle: Native Symfony integration with dependency injection
- Error Handling: Comprehensive error handling and retry mechanisms
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher
Installation
Quick Start
1. Bundle Registration
The bundle should be automatically registered. If not, add it to your
bundles.php:
2. Database Migration
Create and run the database migration:
3. Create WeChat Official Account
4. Making API Requests
Configuration
Access Token Management
The bundle automatically handles access token refresh:
- Tokens are cached in the database
- Automatic refresh when expired
- Thread-safe token refresh using locks
- Configurable token expiration buffer (default: 10 seconds)
Account Entity Features
- Timestamps: Automatic creation and update timestamps
- Blameable: Track created/updated by user
- Indexing: Optimized database queries
- Validation: Built-in validation rules
Callback IP Management
Advanced Usage
Custom API Requests
Create custom requests by extending WithAccountRequest:
Error Handling
The bundle provides comprehensive error handling:
Token Refresh Strategy
Configure token refresh behavior:
API Reference
Services
OfficialAccountClient: Main HTTP client for WeChat APIAccountRepository: Repository for account managementCallbackIPRepository: Repository for callback IP management
Entities
Account: WeChat Official Account configurationCallbackIP: Callback IP address managementAccessTokenAware: Interface for access token aware entities
Requests
GetTokenRequest: Get access tokenGetStableTokenRequest: Get stable access tokenWithAccountRequest: Base class for account-aware requests
Exceptions
WechatApiException: WeChat API related exceptionsTokenRefreshException: Token refresh failures
Testing
Run the test suite:
Run with coverage:
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
All versions of wechat-official-account-bundle with dependencies
doctrine/collections Version ^2.3
doctrine/dbal Version ^4.0
doctrine/doctrine-bundle Version ^2.13
doctrine/orm Version ^3.0
doctrine/persistence Version ^4.1
easycorp/easyadmin-bundle Version ^4
knplabs/knp-menu Version ^3.7
monolog/monolog Version ^3.1
nesbot/carbon Version ^2.72 || ^3
psr/log Version ^3|^2|^1
symfony/cache-contracts Version ^3
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/event-dispatcher Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-client-contracts Version ^3.6
symfony/http-kernel Version ^7.3
symfony/lock Version ^7.3
symfony/property-access Version ^7.3
symfony/security-core Version ^7.3
symfony/yaml Version ^7.3
tourze/bundle-dependency Version 1.*
tourze/doctrine-async-insert-bundle Version 1.0.*
tourze/doctrine-indexed-bundle Version 1.0.*
tourze/doctrine-snowflake-bundle Version 1.1.*
tourze/doctrine-timestamp-bundle Version 1.1.*
tourze/doctrine-track-bundle Version 1.1.*
tourze/doctrine-user-bundle Version 1.0.*
tourze/easy-admin-menu-bundle Version 1.0.*
tourze/http-client-bundle Version 1.1.*
tourze/lock-service-bundle Version 1.0.*
tourze/symfony-dependency-service-loader Version 1.0.*
tourze/wechat-official-account-contracts Version 0.0.*