Download the PHP package tourze/wechat-official-account-menu-bundle without Composer
On this page you can find all versions of the php package tourze/wechat-official-account-menu-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package wechat-official-account-menu-bundle
WeChat Official Account Menu Bundle
[]
(https://packagist.org/packages/tourze/wechat-official-account-menu-bundle)
中文
A comprehensive WeChat Official Account custom menu management bundle for Symfony, providing complete menu management functionality with version control and visual editing support.
Table of Contents
- Features
- Installation
- Requirements
- Dependencies
- Usage
- Advanced Usage
- Data Models
- Events
- Configuration
- Security
- Limitations
- Error Handling
- Roadmap
- License
- References
Features
- 📋 Menu Management: Create, edit, delete, sort, and copy menus
- 📦 Version Control: Menu versioning, publishing, rollback, and comparison
- ✅ Menu Validation: Automatic validation against WeChat restrictions
- 🔄 WeChat API Integration: Automatic menu synchronization to WeChat servers
- 🎯 Personalized Menus: Support for creating and managing personalized menus
- 🌲 Tree Structure: Support for up to two-level menu hierarchy
- 🚀 Performance Optimization: Enable/disable menus, batch operations
Installation
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM
- Valid WeChat Official Account
Dependencies
This bundle requires the following packages:
symfony/framework-bundle- Core Symfony frameworkdoctrine/doctrine-bundle- Database abstraction layertourze/wechat-official-account-bundle- WeChat API integrationsymfony/validator- Data validationsymfony/serializer- Object serialization
Usage
1. Menu Management
Creating Menus
Updating Menus
Menu Sorting
2. Version Management
Creating Versions
Publishing Versions
Version Rollback
Version Comparison
3. API Endpoints
All endpoints return JSON format data.
Menu Version API
GET /admin/menu/version/{id}/menus- Get version menusPOST /admin/menu/version/{id}/menu- Create menu in versionPUT /admin/menu/version/{id}/menu/{menuId}- Update menu in versionDELETE /admin/menu/version/{id}/menu/{menuId}- Delete menu from versionPOST /admin/menu/version/{id}/positions- Update menu positionsPOST /admin/menu/version/{id}/from-current- Create version from current menu
4. Menu Types
Supported menu types (MenuType):
NONE- No action (for parent menus)VIEW- Jump to URLCLICK- Click push eventMINI_PROGRAM- Mini ProgramSCAN_CODE_PUSH- Scan code push eventSCAN_CODE_WAIT_MSG- Scan code with promptPIC_SYS_PHOTO- System photoPIC_PHOTO_ALBUM- Photo albumPIC_WEIXIN- WeChat albumLOCATION_SELECT- Send location
5. Visual Editor Integration
This package provides complete data interface support for frontend visual editors, including:
- Tree menu structure data
- Drag-and-drop sorting support
- Real-time preview
- Version management interface
- Menu validation prompts
Advanced Usage
Personalized Menus
Create conditional menus based on user attributes:
Batch Operations
Efficiently manage multiple menus:
Menu Analytics and Monitoring
Track menu performance:
Error Recovery
Handle failed operations gracefully:
Data Models
MenuButton (Menu Button)
- Supports tree structure (up to two levels)
- Includes sorting and enable/disable status
- Automatic menu structure validation
MenuVersion (Menu Version)
- Auto-generated version numbers
- Status: draft, published, archived
- Saves menu snapshots
- Records publishing history
MenuButtonVersion (Versioned Menu Button)
- Associated with specific versions
- Maintains original button ID for comparison
Events
MenuVersionCreatedEvent- Triggered when version is createdMenuVersionPublishedEvent- Triggered when version is published
Configuration
Configure in config/packages/wechat_official_account_menu.yaml:
Security
Access Control
- Always validate user permissions before menu operations
- Implement proper role-based access control for menu management
- Use CSRF protection for all menu modification forms
Data Validation
- All input data is validated using Symfony Validator
- Menu structures are validated against WeChat API requirements
- URL validation prevents malicious redirects
WeChat API Security
- Store WeChat access tokens securely
- Implement rate limiting for API calls
- Use HTTPS for all WeChat API communications
Recommended Practices
Limitations
According to WeChat official documentation:
- Maximum 3 top-level menus
- Maximum 5 sub-menus per top-level menu
- Menu name maximum 60 characters
- Key value maximum 128 characters
- URL maximum 1024 characters
Error Handling
Roadmap
- [ ] Support for media material menus
- [ ] Support for rich media message menus
- [ ] Batch import/export functionality
- [ ] Menu usage statistics
- [ ] More personalized menu conditions
Contributing
We welcome contributions to this project! Here's how you can help:
Reporting Issues
- Use the GitHub issue tracker to report bugs
- Include as much detail as possible (PHP version, Symfony version, error messages)
- Provide a minimal code example that reproduces the issue
Contributing Code
- Fork the repository and create a feature branch
- Follow the existing code style and conventions
- Write tests for new functionality
- Ensure all tests pass before submitting a PR
- Update documentation if needed
Code Standards
- Follow PSR-12 coding standards
- Use PHP 8.1+ features where appropriate
- Maintain backward compatibility when possible
- Add type declarations for all method parameters and return values
Testing
- All new features must include unit tests
- Integration tests are required for services and repositories
- Maintain test coverage above 80%
License
This project is licensed under the MIT License - see the LICENSE file for details.
References
- [WeChat Official Documentation - Custom Menu Creation] (https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Creating_Custom-Defined_Menu.html)
- [WeChat Official Documentation - Personalized Menu Interface] (https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Personalized_menu_interface.html)
- [WeChat Official Documentation - Get Custom Menu Configuration] (https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Getting_Custom_Menu_Configurations.html)
All versions of wechat-official-account-menu-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 ^3.1 || ^4
symfony/config Version ^6.4
symfony/dependency-injection Version ^6.4
symfony/doctrine-bridge Version ^6.4
symfony/event-dispatcher Version ^6.4
symfony/framework-bundle Version ^6.4
symfony/http-kernel Version ^6.4
symfony/security-http Version ^6.4
symfony/yaml Version ^6.4 || ^7.1
tourze/bundle-dependency Version 0.0.*
tourze/doctrine-indexed-bundle Version 0.0.*
tourze/doctrine-snowflake-bundle Version 0.1.*
tourze/doctrine-timestamp-bundle Version 0.0.*
tourze/doctrine-user-bundle Version 0.0.*
tourze/easy-admin-attribute Version 0.1.*
tourze/enum-extra Version 0.1.*
tourze/json-rpc-core Version 0.0.*
tourze/symfony-integration-test-kernel Version 0.0.*
tourze/wechat-official-account-bundle Version 0.1.*