PHPackages                             tourze/wechat-official-account-draft-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-official-account-draft-bundle

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

tourze/wechat-official-account-draft-bundle
===========================================

微信公众号草稿管理包，提供草稿创建、存储和管理功能

0.0.1(1y ago)075MITPHPPHP ^8.1CI passing

Since May 8Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/wechat-official-account-draft-bundle)[ Packagist](https://packagist.org/packages/tourze/wechat-official-account-draft-bundle)[ RSS](/packages/tourze-wechat-official-account-draft-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (18)Versions (2)Used By (0)

WeChat Official Account Draft Bundle
====================================

[](#wechat-official-account-draft-bundle)

[![PHP Version](https://camo.githubusercontent.com/7535257ca228724c93658bd52583d4e47a9bab02c356abf6e54c1d575f2151e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c75652e737667)](https://www.php.net/releases/)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Build Status](https://camo.githubusercontent.com/c27a457659b89ee4f1f80f7995c559dd37f2051bde7167ad25791e5c5c92cc8e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e2e737667)](#)[![Code Coverage](https://camo.githubusercontent.com/b3545ae1bcdb4ea486f71f87b43001e82dd21933bc8035d44601706c851265da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d627269676874677265656e2e737667)](#)

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

A Symfony bundle for managing WeChat Official Account draft articles.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Configuration](#configuration)
- [Quick Start](#quick-start)
- [Advanced Usage](#advanced-usage)
- [API Reference](#api-reference)
- [Security](#security)
- [License](#license)

Features
--------

[](#features)

- Draft entity management with Doctrine ORM
- Draft deletion functionality
- Support for WeChat Official Account API integration
- Built-in repository for draft operations
- Event-driven architecture with listeners

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

[](#dependencies)

This bundle requires the following packages:

- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher
- tourze/wechat-official-account-bundle

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

[](#installation)

```
composer require tourze/wechat-official-account-draft-bundle
```

Configuration
-------------

[](#configuration)

The bundle integrates with the WeChat Official Account Bundle and requires proper configuration of the WeChat API credentials. Ensure you have configured the main WeChat bundle before using this draft extension.

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

[](#quick-start)

### 1. Configure the bundle

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

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

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

### 2. Create database tables

[](#2-create-database-tables)

Run the Doctrine migrations to create the necessary tables:

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

### 3. Basic Usage

[](#3-basic-usage)

```
use WechatOfficialAccountDraftBundle\Entity\Draft;
use WechatOfficialAccountDraftBundle\Request\DeleteDraftRequest;

// Create a draft
$draft = new Draft();
$draft->setAccount($account);
$draft->setMediaId('media_id_from_wechat');

// Delete a draft
$deleteRequest = new DeleteDraftRequest();
$deleteRequest->setAccount($account);
$deleteRequest->setMediaId('media_id_to_delete');
```

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

[](#advanced-usage)

### Working with Draft Repository

[](#working-with-draft-repository)

```
use WechatOfficialAccountDraftBundle\Repository\DraftRepository;

// Inject the repository
public function __construct(private DraftRepository $draftRepository)
{
}

// Find drafts by account
$drafts = $this->draftRepository->findBy(['account' => $account]);

// Find draft by media ID
$draft = $this->draftRepository->findOneBy(['mediaId' => $mediaId]);
```

### Event Handling

[](#event-handling)

The bundle provides event-driven architecture for handling draft operations. You can listen to draft-related events to implement custom business logic.

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

[](#api-reference)

### Entities

[](#entities)

- `Draft`: Main entity for managing draft articles
    - `account`: Associated WeChat account
    - `mediaId`: WeChat media ID for the draft

### Requests

[](#requests)

- `DeleteDraftRequest`: Request handler for deleting drafts via WeChat API

### Repository

[](#repository)

- `DraftRepository`: Repository for draft database operations

Security
--------

[](#security)

This bundle follows security best practices:

- All input validation is handled through Symfony constraints
- Media ID length is limited to prevent database overflow
- Account associations use foreign key constraints with cascade deletion

If you discover any security vulnerabilities, please report them responsibly.

License
-------

[](#license)

This bundle is released under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance63

Regular maintenance activity

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity35

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

Unknown

Total

1

Last Release

369d ago

### Community

Maintainers

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

---

Tags

wechat

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-wechat-official-account-draft-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-wechat-official-account-draft-bundle/health.svg)](https://phpackages.com/packages/tourze-wechat-official-account-draft-bundle)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[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)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)

PHPackages © 2026

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