tourze / coupon-wechat-mini-program-bundle
微信小程序优惠券配置管理系统
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/tourze/coupon-wechat-mini-program-bundle
Requires
- php: ^8.1
 - doctrine/dbal: ^4.0
 - doctrine/doctrine-bundle: ^2.13
 - doctrine/orm: ^3.0
 - doctrine/persistence: ^3.1 || ^4
 - symfony/config: ^6.4
 - symfony/dependency-injection: ^6.4
 - symfony/doctrine-bridge: ^6.4
 - symfony/framework-bundle: ^6.4
 - symfony/http-kernel: ^6.4
 - symfony/routing: ^6.4
 - symfony/serializer: ^6.4
 - symfony/yaml: ^6.4 || ^7.1
 - tourze/arrayable: 0.0.*
 - tourze/bundle-dependency: 0.0.*
 - tourze/coupon-core-bundle: 0.0.*
 - tourze/doctrine-indexed-bundle: 0.0.*
 - tourze/doctrine-ip-bundle: 0.0.*
 - tourze/doctrine-snowflake-bundle: 0.1.*
 - tourze/doctrine-timestamp-bundle: 0.0.*
 - tourze/doctrine-user-bundle: 0.0.*
 - tourze/easy-admin-attribute: 0.1.*
 - tourze/wechat-mini-program-bundle: 0.1.*
 
Requires (Dev)
- maglnet/composer-require-checker: ^4
 - phpstan/phpstan: ^2.1
 - phpunit/phpunit: ^10.0
 
This package is auto-updated.
Last update: 2025-11-03 06:18:55 UTC
README
A Symfony bundle for integrating WeChat Mini Program functionality with the coupon system.
Table of Contents
- Features
 - Installation
 - Quick Start
 - Configuration
 - API Integration
 - Database Schema
 - Advanced Usage
 - Requirements
 - Contributing
 - License
 
Features
- WeChat Mini Program configuration management
 - Coupon integration with WeChat Mini Program
 - AppID and path configuration
 - Environment version support
 - Doctrine ORM integration
 - RESTful API support
 
Installation
composer require tourze/coupon-wechat-mini-program-bundle
Quick Start
1. Register the bundle
// config/bundles.php return [ // ... Tourze\CouponWechatMiniProgramBundle\CouponWechatMiniProgramBundle::class => ['all' => true], ];
2. Create and configure WeChat Mini Program
<?php use Tourze\CouponWechatMiniProgramBundle\Entity\WechatMiniProgramConfig; use Tourze\CouponCoreBundle\Entity\Coupon; // Create configuration $config = new WechatMiniProgramConfig(); $config->setAppId('your-wechat-app-id'); $config->setPath('pages/coupon/detail'); $config->setEnvVersion('release'); $config->setCoupon($coupon); // Persist to database $entityManager->persist($config); $entityManager->flush();
3. Retrieve configuration
<?php use Tourze\CouponWechatMiniProgramBundle\Repository\WechatMiniProgramConfigRepository; // Get configuration by coupon $config = $repository->findOneBy(['coupon' => $coupon]); // Get API array representation $apiData = $config->retrieveApiArray();
Configuration
The bundle provides the following configuration options:
- appId: WeChat Mini Program App ID
 - path: Jump path within the mini program
 - envVersion: Mini program environment version (release/trial/develop)
 
API Integration
The WechatMiniProgramConfig entity implements ApiArrayInterface and provides
serialization groups for RESTful APIs:
// Get API representation $apiArray = $config->retrieveApiArray(); // Returns: ['id', 'createTime', 'updateTime', 'appId', 'envVersion', 'path']
Advanced Usage
Custom Repository Methods
<?php use Tourze\CouponWechatMiniProgramBundle\Repository\WechatMiniProgramConfigRepository; // Find configurations by App ID $configs = $repository->findBy(['appId' => 'your-app-id']); // Find configurations with specific environment $configs = $repository->findBy(['envVersion' => 'release']);
Validation Constraints
The entity includes automatic validation:
- AppID: Required, max 100 characters
 - Environment Version: Optional, max 20 characters
 - Path: Optional, max 255 characters
 
Database Schema
The bundle creates a coupon_wechat_mini_program_config table with the following fields:
id: Snowflake ID (primary key)coupon_id: Foreign key to coupon tableapp_id: WeChat Mini Program App IDenv_version: Environment versionpath: Jump path- Timestamp fields (created_at, updated_at)
 - User tracking fields (created_by, updated_by)
 - IP tracking fields
 
Requirements
- PHP 8.1+
 - Symfony 7.3+
 - Doctrine ORM 3.0+
 - Doctrine DBAL 4.0+
 
Testing
The bundle includes comprehensive test coverage:
- Unit tests for entity functionality
 - Integration tests for repository operations
 - Isolated test environment to avoid external dependencies
 
Run tests with:
./vendor/bin/phpunit packages/coupon-wechat-mini-program-bundle/tests
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.