PHPackages                             tourze/wechat-mini-program-custom-service-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/wechat-mini-program-custom-service-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

tourze/wechat-mini-program-custom-service-bundle
================================================

微信小程序客服消息服务包，提供发送文本、图片、链接和小程序卡片消息的功能

0.1.0(4mo ago)00MITPHPCI passing

Since Nov 5Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/wechat-mini-program-custom-service-bundle)[ Packagist](https://packagist.org/packages/tourze/wechat-mini-program-custom-service-bundle)[ RSS](/packages/tourze-wechat-mini-program-custom-service-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (30)Versions (4)Used By (0)

WeChat Mini Program Custom Service Bundle
=========================================

[](#wechat-mini-program-custom-service-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/c71115813ca4bde126fb995d17c9c3947852ce3b2c2dce7f7c9fcb8d91e2749f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f7765636861742d6d696e692d70726f6772616d2d637573746f6d2d736572766963652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/wechat-mini-program-custom-service-bundle)[![PHP Version](https://camo.githubusercontent.com/32b07f21f5952acefd849fb4957c830d4a6f9121e4158279730451035426f1db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f7765636861742d6d696e692d70726f6772616d2d637573746f6d2d736572766963652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/wechat-mini-program-custom-service-bundle)[![Build Status](https://camo.githubusercontent.com/0346e18af1343d739d0405776c07b83798d5bb0200e3efcfdf657e5e662f6403/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f75727a652f7068702d6d6f6e6f7265706f2f63692e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/tourze/php-monorepo/actions)[![Code Coverage](https://camo.githubusercontent.com/6ce0146325478eb7cebae4cc6139b2af2c161735dd0e3c6ff6802f2c5a708179/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f7068702d6d6f6e6f7265706f3f7374796c653d666c61742d737175617265)](https://codecov.io/gh/tourze/php-monorepo)[![License](https://camo.githubusercontent.com/61a541cdaba6f6d10a7ebc539659105859de8415e19a59def90632f9a20c6ab9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f7765636861742d6d696e692d70726f6772616d2d637573746f6d2d736572766963652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/wechat-mini-program-custom-service-bundle)[![Total Downloads](https://camo.githubusercontent.com/c6a01ba278909b6ce0949f6756b86aeb62723242fed63f060adb452d81c7a54a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f7765636861742d6d696e692d70726f6772616d2d637573746f6d2d736572766963652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/wechat-mini-program-custom-service-bundle)

A Symfony bundle for managing WeChat Mini Program custom service messages, providing comprehensive support for sending various message types including text, images, links, and mini program pages.

Features
--------

[](#features)

- 🎯 **Multiple Message Types**: Support for text, image, link, and mini program page messages
- 📦 **Doctrine Integration**: Full ORM support with entity repositories
- 🔄 **Event System**: Event subscribers for message handling
- 🚀 **Easy Configuration**: Symfony bundle with auto-configuration
- 📝 **Type Safety**: Comprehensive type annotations and PHPStan level 5 compliance
- ✅ **Fully Tested**: 100% test coverage with PHPUnit

Dependencies
------------

[](#dependencies)

This bundle requires:

- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher
- tourze/wechat-mini-program-bundle

Installation
------------

[](#installation)

```
composer require tourze/wechat-mini-program-custom-service-bundle
```

### 1. Register the Bundle

[](#1-register-the-bundle)

Add the bundle to your `config/bundles.php`:

```
return [
    // ... other bundles
    WechatMiniProgramCustomServiceBundle\WechatMiniProgramCustomServiceBundle::class => ['all' => true],
];
```

### 2. Configure Database

[](#2-configure-database)

Run database migrations to create the message tables:

```
php bin/console doctrine:migrations:migrate
```

Quick Start
-----------

[](#quick-start)

```
use WechatMiniProgramCustomServiceBundle\Entity\TextMessage;
use WechatMiniProgramCustomServiceBundle\Request\SendMessageRequest;

// Create a text message
$textMessage = new TextMessage();
$textMessage->setTouser('user_openid');
$textMessage->setContent('Hello from WeChat Mini Program!');
$textMessage->setAccount($account);

// Send the message
$request = new SendMessageRequest();
$request->setMessage($textMessage);
$request->setAccount($account);

// Use your HTTP client to send the request
```

Advanced Usage
--------------

[](#advanced-usage)

### Message Types

[](#message-types)

#### Text Message

[](#text-message)

```
$textMessage = new TextMessage();
$textMessage->setTouser('user_openid')
           ->setContent('Your message content')
           ->setAccount($account);
```

#### Image Message

[](#image-message)

```
$imageMessage = new ImageMessage();
$imageMessage->setTouser('user_openid')
            ->setMediaId('media_id_from_wechat')
            ->setAccount($account);
```

#### Link Message

[](#link-message)

```
$linkMessage = new LinkMessage();
$linkMessage->setTouser('user_openid')
           ->setTitle('Link Title')
           ->setDescription('Link Description')
           ->setUrl('https://example.com')
           ->setThumbUrl('https://example.com/thumb.jpg')
           ->setAccount($account);
```

#### Mini Program Page Message

[](#mini-program-page-message)

```
$mpPageMessage = new MpPageMessage();
$mpPageMessage->setTouser('user_openid')
             ->setTitle('Page Title')
             ->setPagePath('pages/index/index')
             ->setThumbMediaId('thumb_media_id')
             ->setAccount($account);
```

### Configuration

[](#configuration)

The bundle provides auto-configuration for all services. Simply register the bundle and the services will be available for dependency injection.

```
# config/services.yaml
services:
    # Services are auto-configured
    _defaults:
        autowire: true
        autoconfigure: true
```

### Event System

[](#event-system)

The bundle includes an event listener for message handling:

```
use WechatMiniProgramCustomServiceBundle\EventSubscriber\MessageListener;

// The MessageListener automatically handles message events
// when integrated with the WeChat Mini Program bundle
```

API Reference
-------------

[](#api-reference)

For detailed API documentation, please refer to:

- [WeChat Mini Program Custom Message API](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/kf-mgnt/kf-message/sendCustomMessage.html)

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance79

Regular maintenance activity

Popularity0

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Total

3

Last Release

140d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-wechat-mini-program-custom-service-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-wechat-mini-program-custom-service-bundle/health.svg)](https://phpackages.com/packages/tourze-wechat-mini-program-custom-service-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
