tourze / wechat-mini-program-log-bundle
微信小程序日志管理Bundle,提供错误日志、反馈和处罚记录的同步和管理功能
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/tourze/wechat-mini-program-log-bundle
Requires
- ext-json: *
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^3.0
- doctrine/persistence: ^4.1
- easycorp/easyadmin-bundle: ^4
- knplabs/knp-menu: ^3.7
- monolog/monolog: ^3.1
- nesbot/carbon: ^2.72 || ^3
- psr/log: ^3|^2|^1
- symfony/config: ^7.3
- symfony/console: ^7.3
- symfony/dependency-injection: ^7.3
- symfony/doctrine-bridge: ^7.3
- symfony/framework-bundle: ^7.3
- symfony/http-kernel: ^7.3
- symfony/property-access: ^7.3
- symfony/routing: ^7.3
- symfony/yaml: ^7.3
- tourze/bundle-dependency: 1.*
- tourze/doctrine-snowflake-bundle: 1.1.*
- tourze/doctrine-timestamp-bundle: 1.1.*
- tourze/easy-admin-enum-field-bundle: 1.0.*
- tourze/easy-admin-menu-bundle: 1.0.*
- tourze/enum-extra: 1.0.*
- tourze/symfony-cron-job-bundle: 1.1.*
- tourze/symfony-dependency-service-loader: 1.0.*
- tourze/symfony-routing-auto-loader-bundle: 1.0.*
- tourze/wechat-mini-program-bundle: 1.0.*
Requires (Dev)
- doctrine/data-fixtures: ^2.0
- doctrine/doctrine-fixtures-bundle: ^4.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- tourze/http-client-bundle: 1.1.*
- tourze/phpunit-base: 1.*
- tourze/phpunit-doctrine-entity: 1.*
- tourze/phpunit-enum: 1.*
- tourze/phpunit-symfony-kernel-test: 1.0.*
- tourze/phpunit-symfony-unit-test: 1.*
- tourze/phpunit-symfony-web-test: 1.*
This package is auto-updated.
Last update: 2025-11-18 08:40:01 UTC
README
A Symfony bundle for managing WeChat Mini Program logs, including error tracking, feedback collection, and penalty management.
Table of Contents
- Features
- Installation
- Quick Start
- Configuration
- Dependencies
- Commands
- Entities
- Advanced Usage
- Security
- Automated Scheduling
- License
Features
- Error Tracking: Monitor and collect JavaScript errors from WeChat Mini Programs
- Feedback Management: Collect and manage user feedback from mini programs
- Penalty Monitoring: Track transaction experience score violations
- Automated Synchronization: Scheduled commands for data synchronization
- Entity Management: Doctrine entities for structured data storage
Installation
composer require tourze/wechat-mini-program-log-bundle
Quick Start
1. Register the Bundle
Add the bundle to your config/bundles.php:
return [ // ... WechatMiniProgramLogBundle\WechatMiniProgramLogBundle::class => ['all' => true], ];
2. Configure Services
The bundle automatically registers its services. Make sure you have the required dependencies installed.
3. Database Setup
Create and run migrations for the entity tables:
php bin/console make:migration php bin/console doctrine:migrations:migrate
Configuration
The bundle uses the WeChat Mini Program API client from
tourze/wechat-mini-program-bundle. Ensure your WeChat accounts are properly
configured with valid API credentials.
Example configuration in config/packages/wechat_mini_program.yaml:
wechat_mini_program: accounts: default: app_id: 'your_app_id' app_secret: 'your_app_secret'
Dependencies
This bundle requires the following packages:
- PHP 8.1 or higher
- Symfony 6.4 or higher
tourze/wechat-mini-program-bundle ^0.1- WeChat Mini Program API clienttourze/doctrine-timestamp-bundle ^0.0- Timestamp managementtourze/doctrine-snowflake-bundle ^0.1- Snowflake ID generationtourze/enum-extra ^0.1- Enhanced enum functionalitytourze/symfony-cron-job-bundle ^0.1- Automated task scheduling
Commands
The bundle provides four console commands for data synchronization:
Error Management
# Synchronize error list from WeChat API php bin/console wechat-mini-program:sync-get-error-list # Synchronize error details from WeChat API php bin/console wechat-mini-program:sync-get-error-detail
Feedback Collection
# Collect user feedback from mini programs
php bin/console wechat-mini-program:get-feedback
Penalty Monitoring
# Monitor transaction experience score violations
php bin/console wechat-mini-program:get-penalty
Entities
The bundle includes several entities for data management:
ErrorDetail: Detailed JavaScript error informationErrorListData: Aggregated error statisticsFeedback: User feedback dataPenaltyList: Transaction violation records
Advanced Usage
Custom Repository Usage
use WechatMiniProgramLogBundle\Repository\ErrorDetailRepository; class MyService { public function __construct( private ErrorDetailRepository $errorDetailRepository ) {} public function findRecentErrors(): array { return $this->errorDetailRepository->findBy( ['date' => new \DateTime('-7 days')], ['createTime' => 'DESC'], 10 ); } }
Event Listeners
Register custom event listeners to handle error data:
use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ErrorEventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents(): array { return [ 'wechat.error.created' => 'onErrorCreated', ]; } public function onErrorCreated(ErrorEvent $event): void { // Custom error handling logic } }
Security
Data Validation
All entities include comprehensive validation constraints to ensure data integrity:
- String length limits prevent database overflow
- Type validation ensures proper data types
- Enum validation restricts values to valid choices
Access Control
The bundle does not include built-in access control. Implement appropriate security measures in your application:
- Use Symfony Security component for authentication
- Implement proper authorization checks
- Validate API credentials securely
Sensitive Data
Be aware that this bundle processes:
- User feedback data
- Error information that may contain sensitive details
- OpenID identifiers
Ensure compliance with relevant data protection regulations.
Automated Scheduling
All commands are configured with cron expressions for automated execution:
- Error list sync: Daily at 3:06 AM and 11:35 AM
- Error detail sync: Daily at 4:02 AM and 8:22 AM
- Feedback collection: Hourly at 15 minutes past
- Penalty monitoring: Daily at 1:40 AM and 1:45 PM
Contributing
We welcome contributions! Please see our contributing guidelines for details on:
- How to submit issues
- How to submit pull requests
- Code style requirements
- Testing requirements
License
This bundle is under the MIT license. See the complete license in the bundle: