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)077MITPHPPHP ^8.1CI passing

Since May 8Pushed 6mo 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 today

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

29

—

LowBetter than 57% of packages

Maintenance57

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity36

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

422d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13899502?v=4)[tourze](/maintainers/tourze)[@tourze](https://github.com/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

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[open-dxp/opendxp

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

9421.6k61](/packages/open-dxp-opendxp)[sylius/sylius

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

8.5k5.9M739](/packages/sylius-sylius)[pimcore/pimcore

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

3.8k3.8M508](/packages/pimcore-pimcore)[sulu/sulu

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

1.3k1.4M204](/packages/sulu-sulu)

PHPackages © 2026

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