PHPackages                             git-mz/tkmatch - 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. git-mz/tkmatch

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

git-mz/tkmatch
==============

v1.1.0(4y ago)160PHP

Since Feb 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/git-mz/tkmatch)[ Packagist](https://packagist.org/packages/git-mz/tkmatch)[ RSS](/packages/git-mz-tkmatch/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

tkmatch
=======

[](#tkmatch)

> 文本关键词匹配程序，主要采用DFA算法实现。

### DFA算法

[](#dfa算法)

> DFA 即 Deterministic Finite Automaton，也就是确定有穷自动机，它是是通过event和当前的state得到下一个state，即event+state=nextstate。更多关于DFA算法的了解可上网学习。

### 使用场景

[](#使用场景)

```
v1.1.0
文本中匹配指定词组，替换为带链接的标签

```

### 使用方法

[](#使用方法)

1、引入包

```
composer require git-mz/tkmatch
```

2、调用

```
use tkmatch\main;

$main    = new Main();
$content = '我会脚踏云朵，哦不，是七彩云朵去娶你！';
$tags = [
    ['word' => '云朵',      'url' => 'www.yunduo.com'],
    ['word' => '七彩云朵',  'url' => 'www.qicaiyunduo.com'],
];

// 获取匹配到的tags
$res = $main::init()
     ->setTree($tags)
     ->getTagWord($content, $wordNum = 0);

// 替换匹配到的tags
$res = $main::init()
     ->setTree($tags)
     ->replace($content, $newclass = '', $replaceOne = 0);
```

3、方法说明

```
v1.1.0
    getTagWord(String content, Int wordNum)
    //获取文本中匹配到的标签
    replace(String content, String newclass, Int replaceOne)
    //匹配替换文本中的标签
```

### 小结一下

[](#小结一下)

> 好好学习，天天向上！ 代码不定期迭代...

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Total

2

Last Release

1812d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88199eb8e0759bb9de146534af7fa09365b34badbf8b3069ea8aa321faca6dc5?d=identicon)[git-mz](/maintainers/git-mz)

---

Top Contributors

[![git-well](https://avatars.githubusercontent.com/u/12929614?v=4)](https://github.com/git-well "git-well (24 commits)")

### Embed Badge

![Health badge](/badges/git-mz-tkmatch/health.svg)

```
[![Health](https://phpackages.com/badges/git-mz-tkmatch/health.svg)](https://phpackages.com/packages/git-mz-tkmatch)
```

###  Alternatives

[donatello-za/rake-php-plus

Yet another PHP implementation of the Rapid Automatic Keyword Extraction algorithm (RAKE).

270929.5k11](/packages/donatello-za-rake-php-plus)

PHPackages © 2026

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