PHPackages                             chuoke/keyword-linkify - 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. chuoke/keyword-linkify

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

chuoke/keyword-linkify
======================

Replace keywords in articles with links

1.0.1(3y ago)02[2 PRs](https://github.com/chuoke/keyword-linkify/pulls)MITPHPPHP ^8

Since Oct 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/chuoke/keyword-linkify)[ Packagist](https://packagist.org/packages/chuoke/keyword-linkify)[ Docs](https://github.com/chuoke/keyword-linkify)[ GitHub Sponsors](https://github.com/chuoke)[ RSS](/packages/chuoke-keyword-linkify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

Replace keywords in articles with links 替换文章中关键词为链接
===================================================

[](#replace-keywords-in-articles-with-links-替换文章中关键词为链接)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1f5555660b0a6a20dee5bd350b5663b9d62a6110320e525eb85ffb5dc2629483/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368756f6b652f6b6579776f72642d6c696e6b6966792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chuoke/keyword-linkify)[![Tests](https://github.com/chuoke/keyword-linkify/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/chuoke/keyword-linkify/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/bcd61e396810f200292bc1d6ab0d8eab6a5607e358620236c46e793a93aa0c2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368756f6b652f6b6579776f72642d6c696e6b6966792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chuoke/keyword-linkify)

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

[](#installation)

You can install the package via composer:

```
composer require chuoke/keyword-linkify
```

Usage
-----

[](#usage)

```
$text = '
    A popular general-purpose scripting language that is especially suited to web development.Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.';

$keywords = [
    [
        'keyword' => 'php',
        'url' => 'https://www.php.net/',
    ],
];

$keywordLinkify = new Chuoke\KeywordLinkify();
echo $keywordLinkify->replace($text, $keywords);
```

The result:

```
A popular general-purpose scripting language that is especially suited to web development.Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.
```

[![](./imgs/example-1.png)](./imgs/example-1.png)

As you can see, it won't replace attribute text.

More example see tests.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

2

Last Release

1293d ago

### Community

Maintainers

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

---

Top Contributors

[![chuoke](https://avatars.githubusercontent.com/u/17611457?v=4)](https://github.com/chuoke "chuoke (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

chuokekeyword-linkify

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/chuoke-keyword-linkify/health.svg)

```
[![Health](https://phpackages.com/badges/chuoke-keyword-linkify/health.svg)](https://phpackages.com/packages/chuoke-keyword-linkify)
```

PHPackages © 2026

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