PHPackages                             markfullmer/porter2 - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. markfullmer/porter2

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

markfullmer/porter2
===================

Stem words using the English Porter 2 algorithm

1.0(9y ago)1628.2k[2 PRs](https://github.com/markfullmer/porter2/pulls)1MITPHP

Since Apr 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/markfullmer/porter2)[ Packagist](https://packagist.org/packages/markfullmer/porter2)[ RSS](/packages/markfullmer-porter2/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (3)Used By (1)

Porter 2 Stemmer for PHP
========================

[](#porter-2-stemmer-for-php)

[![Circle CI](https://camo.githubusercontent.com/c5b3b32e6b6bf4902cf9d8d057af450f3ccb0aa5fac0396086bb58fc6f17ac09/68747470733a2f2f636972636c6563692e636f6d2f67682f6d61726b66756c6c6d65722f706f72746572322e7376673f7374796c653d736869656c64)](https://circleci.com/gh/markfullmer/porter2)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://raw.githubusercontent.com/markfullmer/porter2/master/LICENSE)

A PHP library for stemming words using the English Porter 2 algorithm.

[![Screenshot of Conversion](https://raw.githubusercontent.com/markfullmer/porter2/master/demo/stemmer-demo.png)](https://raw.githubusercontent.com/markfullmer/porter2/master/demo/stemmer-demo.png)

Background
----------

[](#background)

A stemmer takes a given word and follows a set of rules to reduce this word to search-index-usable stem (as opposed to the actual word root). For example, *aggravate*, *aggravated*, and *aggravates* all reduce to "aggrav," thus creating a commonality between those words.

Martin Porter's English (Porter 2) Algorithm improves on the original Porter stemmer as described [here](http://snowball.tartarus.org/algorithms/english/stemmer.html).

Basic Usage
-----------

[](#basic-usage)

The included `/demo/index.php` file contains a conversion form demonstration.

Make your code aware of the `Porter2` class via your favorite method (e.g., `use` or `require`)

Then pass a string of text into the class:

```
$text = Porter2::stem('consistently');
echo $text; // consist

$text = Porter2::stem('consisting');
echo $text; // consist

$text = Porter2::stem('consistency');
echo $text; // consist
```

Stemmer Resources
-----------------

[](#stemmer-resources)

- [Step definition for the Porter 2 stemmer](http://snowball.tartarus.org/algorithms/english/stemmer.html)

Tests
-----

[](#tests)

A verification list of 29,000 words and their expected stems can be run (after `composer install` via `phpunit`).

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Unknown

Total

1

Last Release

3328d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

corpusphpportersearch-algorithmstemmer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/markfullmer-porter2/health.svg)

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

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[karriere/json-decoder

JsonDecoder implementation that allows you to convert your JSON data into PHP class objects

140439.4k12](/packages/karriere-json-decoder)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46143.1k6](/packages/jstewmc-rtf)[json-mapper/laravel-package

The JsonMapper package for Laravel

25188.9k3](/packages/json-mapper-laravel-package)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)

PHPackages © 2026

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