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(8mo ago)02.8k7MITPHPCI passing

Since Apr 19Pushed 6mo 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 today

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 79% of packages

Maintenance65

Regular maintenance activity

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity39

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

241d ago

Major Versions

0.0.1 → 1.0.02025-11-04

### Community

Maintainers

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

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.8k](/packages/contao-core-bundle)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[sylius/sylius

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

8.5k5.9M737](/packages/sylius-sylius)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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