PHPackages                             tourze/text-manage-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/text-manage-bundle

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

tourze/text-manage-bundle
=========================

文本格式化管理

1.0.0(6mo ago)02.7k7MITPHPCI passing

Since Apr 19Pushed 4mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (18)Versions (3)Used By (7)

TextManageBundle
================

[](#textmanagebundle)

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

TextManageBundle 是一个轻量级的 Symfony Bundle，提供文本格式化和处理的功能。

功能
--

[](#功能)

- 纯文本处理
- Markdown 格式化
- Twig 模板解析

安装
--

[](#安装)

```
composer require tourze/text-manage-bundle
```

在 `config/bundles.php` 中注册 Bundle：

```
return [
    // ...
    Tourze\TextManageBundle\TextManageBundle::class => ['all' => true],
];
```

使用方法
----

[](#使用方法)

### 基本用法

[](#基本用法)

```
use Tourze\TextManageBundle\Service\TextFormatter;

class MyService
{
    public function __construct(
        private readonly TextFormatter $textFormatter
    ) {
    }

    public function process(): string
    {
        // 基本文本处理
        return $this->textFormatter->formatText('Hello World');
    }
}
```

### Twig 语法处理

[](#twig-语法处理)

```
// 传入参数解析 Twig 语法
$params = ['name' => 'John'];
$text = 'Hello {{ name }}!';
$result = $textFormatter->formatText($text, $params); // 返回 "Hello John!"

// 复杂 Twig 语法
$params = ['items' => ['apple', 'banana', 'orange']];
$text = '{% for item in items %}{{ item }}{% if not loop.last %}, {% endif %}{% endfor %}';
$result = $textFormatter->formatText($text, $params); // 返回 "apple, banana, orange"
```

### Markdown 处理

[](#markdown-处理)

```
// Markdown 格式化
$text = '# Title\n\n**Bold text**';
$result = $textFormatter->formatText($text); // 返回纯文本，移除 HTML 标签
```

装饰器模式
-----

[](#装饰器模式)

本包使用装饰器模式实现了文本格式化处理的链式调用：

1. `PlainFormatter` - 基本文本处理
2. `MarkdownFormatter` - Markdown 格式化（装饰 TextFormatter）
3. `TwigFormatter` - Twig 模板解析（装饰 TextFormatter）

单元测试
----

[](#单元测试)

```
./vendor/bin/phpunit packages/text-manage-bundle/tests
```

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance72

Regular maintenance activity

Popularity16

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~199 days

Total

2

Last Release

187d ago

Major Versions

0.0.1 → 1.0.02025-11-04

### Community

Maintainers

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

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-text-manage-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-text-manage-bundle/health.svg)](https://phpackages.com/packages/tourze-text-manage-bundle)
```

###  Alternatives

[sylius/sylius

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

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

Contao Open Source CMS

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

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[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)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M309](/packages/easycorp-easyadmin-bundle)

PHPackages © 2026

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