tourze / tencent-cloud-sms-bundle
腾讯云短信服务集成模块,支持消息发送、状态同步和统计分析
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/tourze/tencent-cloud-sms-bundle
Requires
- ext-json: *
- doctrine/collections: ^2.3
- doctrine/common: ^3.5
- doctrine/data-fixtures: ^2.0
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/doctrine-fixtures-bundle: ^4.0
- doctrine/orm: ^3.0
- doctrine/persistence: ^4.1
- easycorp/easyadmin-bundle: ^4
- knplabs/knp-menu: ^3.7
- monolog/monolog: ^3.1
- 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-foundation: ^7.3
- symfony/http-kernel: ^7.3
- symfony/property-access: ^7.3
- symfony/routing: ^7.3
- symfony/security-core: ^7.3
- symfony/serializer: ^7.3
- symfony/yaml: ^7.3
- tencentcloud/common: ^3.0.1327
- tencentcloud/sms: ^3.0.1327
- tourze/bundle-dependency: 1.*
- tourze/doctrine-indexed-bundle: 1.0.*
- tourze/doctrine-timestamp-bundle: 1.0.*
- tourze/doctrine-track-bundle: 1.0.*
- tourze/doctrine-user-bundle: 1.0.*
- tourze/easy-admin-enum-field-bundle: 1.0.*
- tourze/easy-admin-menu-bundle: 1.0.*
- tourze/enum-extra: 1.0.*
- tourze/symfony-dependency-service-loader: 1.0.*
- tourze/symfony-routing-auto-loader-bundle: 1.0.*
Requires (Dev)
This package is auto-updated.
Last update: 2025-11-11 13:21:03 UTC
README
Tencent Cloud SMS service integration module providing comprehensive SMS sending, status synchronization, and statistical data management functionality.
Table of Contents
- Features
- Requirements
- Installation
- Configuration
- Quick Start
- Available Commands
- Core Services
- Advanced Usage
- Contributing
- License
Features
- 📤 SMS sending service with template support
- 📊 SMS statistics data synchronization
- 📝 SMS template status management and review
- ✉️ SMS signature status management and review
- 🔍 Phone number information query service
- 📈 Real-time SMS delivery status synchronization
- 🖼️ Image upload and processing for signatures/templates
- 📋 Comprehensive SMS message and recipient management
- 🔄 Automated status sync commands
- 📈 Advanced statistics and reporting
Requirements
- PHP >= 8.1
- Symfony >= 7.3
- Doctrine ORM >= 3.0
- Tencent Cloud SMS SDK
Installation
composer require tourze/tencent-cloud-sms-bundle
Configuration
1. Register the Bundle
Add the bundle to your config/bundles.php:
<?php return [ // ... TencentCloudSmsBundle\TencentCloudSmsBundle::class => ['all' => true], ];
2. Configure Doctrine Entities
The bundle provides these main entities that need to be configured in your database:
Account- Tencent Cloud SMS account configurationSmsMessage- SMS message recordsSmsRecipient- SMS recipient informationSmsSignature- SMS signature managementSmsTemplate- SMS template managementSmsStatistics- SMS statistics dataPhoneNumberInfo- Phone number information
Quick Start
Basic SMS Sending
<?php use TencentCloudSmsBundle\Service\SmsSendService; use TencentCloudSmsBundle\Entity\SmsRecipient; class SmsController { public function __construct( private SmsSendService $smsSendService ) {} public function sendSms(SmsRecipient $recipient): void { // Send SMS to the specified recipient $this->smsSendService->send($recipient); } }
Status Synchronization
<?php use TencentCloudSmsBundle\Service\StatusSyncService; class SyncController { public function __construct( private StatusSyncService $statusSyncService ) {} public function syncStatus(): void { // Sync SMS delivery status $this->statusSyncService->sync(); } }
Available Commands
Synchronization Commands
Sync Phone Number Information
bin/console tencent-cloud:sms:sync:phone-number-info
Synchronizes phone number information for all accounts.
Sync SMS Signature Status
bin/console tencent-cloud:sms:sync:sign-status
Synchronizes SMS signature review status.
Sync SMS Delivery Status
bin/console tencent-cloud:sms:sync:status
Synchronizes SMS delivery status (success, failure, etc.).
Sync SMS Template Status
bin/console tencent-cloud:sms:sync:template-status
Synchronizes SMS template review status.
Sync Unknown Status SMS Records
bin/console tencent-cloud:sms:sync:unknown-status [--limit=100]
Synchronizes SMS records with unknown status. You can specify the maximum number of records to sync per batch.
Sync SMS Statistics Data
bin/console tencent-cloud:sms:sync-statistics \ [--start-time="Y-m-d H:i:s"] [--end-time="Y-m-d H:i:s"] [--account-id=123]
Synchronizes SMS statistics data for the specified time range and account.
Core Services
SmsSendService
Handles SMS sending operations with template support.
StatusSyncService
Manages synchronization of SMS delivery status from Tencent Cloud.
StatisticsSyncService
Synchronizes SMS statistics data for reporting and analytics.
PhoneNumberInfoService
Queries and manages phone number information and validation.
SmsClient
Wrapper for Tencent Cloud SMS SDK client operations.
Advanced Usage
Custom Template Parameters
<?php use TencentCloudSmsBundle\Entity\SmsMessage; $message = new SmsMessage(); $message->setTemplateParams([ 'code' => '123456', 'expiry' => '5' ]);
Batch Status Synchronization
<?php use TencentCloudSmsBundle\Service\StatusSyncService; class BatchSyncService { public function __construct( private StatusSyncService $statusSyncService ) {} public function syncBatchStatus(): void { // Sync status for all pending messages $this->statusSyncService->sync(); } }
Statistics Reporting
<?php use TencentCloudSmsBundle\Repository\SmsStatisticsRepository; class ReportService { public function __construct( private SmsStatisticsRepository $statisticsRepository ) {} public function getDailyStats(\DateTime $date): array { return $this->statisticsRepository->findByDate($date); } }
Testing
Run the test suite with:
# Run all tests ./vendor/bin/phpunit packages/tencent-cloud-sms-bundle/tests # Run with coverage ./vendor/bin/phpunit packages/tencent-cloud-sms-bundle/tests --coverage-html=coverage # Run PHPStan analysis ./vendor/bin/phpstan analyse packages/tencent-cloud-sms-bundle
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
License
The MIT License (MIT). Please see License File for more information.