PHPackages                             writecrow/highlighter - 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. writecrow/highlighter

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

writecrow/highlighter
=====================

Highlights words/phrases per specified parameters

2.0.3(1y ago)29431[1 issues](https://github.com/writecrow/highlighter/issues)MITPHP

Since Sep 7Pushed 1y ago4 watchersCompare

[ Source](https://github.com/writecrow/highlighter)[ Packagist](https://packagist.org/packages/writecrow/highlighter)[ RSS](/packages/writecrow-highlighter/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)DependenciesVersions (11)Used By (0)

Excerpt Highlighter
===================

[](#excerpt-highlighter)

A PHP library for creating a highlighted excerpt a provided list of tokens in a provided text string.

Basic usage in an application
-----------------------------

[](#basic-usage-in-an-application)

The included `index.php` file contains a generation form demo.

Make your code aware of the Highlighter class via your favorite method (e.g., `use writecrow\Highlighter\HighlightExcerpt;`)

```
print HighlightExcerpt::highlight('Round the rugged rock,' ['the']);
// Will print 'Round the rugged rock'

print HighlightExcerpt::highlight('Round the rugged rock,' ['the', 'rock']);
// Will print 'Round the rugged rock'

print HighlightExcerpt::highlight('Round the rugged rock,' ['ro', '"round"']);
// Will print 'Round the rugged rock', since `ro` is present,
// but only a word partial,
// and `round` is present, but double-quotes indicate case-sensitivity
// so `round` != `Round`
```

Advanced behaviors
------------------

[](#advanced-behaviors)

The excerpt highlighter will:

- Default to case-insensitive highlighting for a word (e.g., `'the'`)
- Become case-sensitive if the token is wrapped in double quotes (e.g. `'"The"'`)
- Not highlight partial word matched (e.g., `'the'` will not highlight `therefore`)
- Given multiple tokens passed to be highlighted, will create shorter, concatenated excerpts from the text which overall try to honor the length parameter specified (see below)
- Produce excerpts that start/end on word boundaries

### Length

[](#length)

Pass a 3rd parameter, an integer, to the function to specify the desired length of the excerpt.

```
print HighlightExcerpt::highlight('Round the rugged rock,' ['the'], 300);
// Would limit the excerpt to 300 characters
```

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 94.6% 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 ~220 days

Recently: every ~209 days

Total

10

Last Release

550d ago

Major Versions

1.2.2 → 2.0.02022-10-29

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4305692?v=4)[Mark Fullmer](/maintainers/markfullmer)[@markfullmer](https://github.com/markfullmer)

![](https://avatars.githubusercontent.com/u/27739911?v=4)[Corpus &amp; Repository of Writing (Crow)](/maintainers/writecrow)[@writecrow](https://github.com/writecrow)

---

Top Contributors

[![markfullmer](https://avatars.githubusercontent.com/u/4305692?v=4)](https://github.com/markfullmer "markfullmer (35 commits)")[![jmf3658](https://avatars.githubusercontent.com/u/34824280?v=4)](https://github.com/jmf3658 "jmf3658 (2 commits)")

---

Tags

highlightnatural-language-processingphp-library

### Embed Badge

![Health badge](/badges/writecrow-highlighter/health.svg)

```
[![Health](https://phpackages.com/badges/writecrow-highlighter/health.svg)](https://phpackages.com/packages/writecrow-highlighter)
```

###  Alternatives

[jcchavezs/cmb2-conditionals

CMB2 Conditionals is a plugin for CMB2 which allows developers to relate fields so one of them could only appear when one other have an specific value or when is not empty.

928.2k](/packages/jcchavezs-cmb2-conditionals)[vakata/asn1

An ASN1 encoder / decoder

1629.6k3](/packages/vakata-asn1)[optimistdigital/nova-resizable

Simple Laravel Nova tool to enable column resizing

1820.2k](/packages/optimistdigital-nova-resizable)

PHPackages © 2026

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