PHPackages                             dompat/stemmer - 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. [Search &amp; Filtering](/categories/search)
4. /
5. dompat/stemmer

ActiveLibrary[Search &amp; Filtering](/categories/search)

dompat/stemmer
==============

A strictly-typed stemming library for PHP 8.3+. Supports Czech and English with Light and Aggressive modes.

v1.0.2(2mo ago)1171MITPHPPHP ^8.3CI passing

Since Feb 25Pushed 2mo agoCompare

[ Source](https://github.com/domPatera/stemmer)[ Packagist](https://packagist.org/packages/dompat/stemmer)[ RSS](/packages/dompat-stemmer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (1)

PHP Stemmer
===========

[](#php-stemmer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9786ead26a58bec17b5591e070e2c06971114400c8ee1f785970e7068c3f3b9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6d7061742f7374656d6d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dompat/stemmer)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/9b1c2ec370d2da74a2681f72145815e4b88d9bab5a95ae327e2170dc122fc6b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e332d3838393262662e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Total Downloads](https://camo.githubusercontent.com/4720221beb662295a88e1d7e0d47138aef98157518f59d22949060f7c06af2ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f6d7061742f7374656d6d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dompat/stemmer)

A strictly-typed stemming library for PHP 8.3+. This library helps reduce words to their base form, which is essential for quality full-text search, indexing, or text analysis.

✨ Features
----------

[](#-features)

- **Modern PHP:** Fully utilizes PHP 8.3+ features (Enums, strict typing).
- **Multiple Modes:**
    - `LIGHT`: Removes only basic suffixes (plurals, cases). Ideal for result highlighting (words remain readable).
    - `AGGRESSIVE`: Reduces words to their morphological root. Ideal for search indexes.
- **Customizable:** Easily extend with your own language drivers.
- **Supported Languages:** Czech, English

🚀 Installation
--------------

[](#-installation)

You can install the library via [Composer](https://getcomposer.org/):

```
composer require dompat/stemmer
```

📖 Usage
-------

[](#-usage)

### Basic Example

[](#basic-example)

```
use Dompat\Stemmer\Stemmer;
use Dompat\Stemmer\Driver\CzechDriver;
use Dompat\Stemmer\Driver\EnglishDriver;
use Dompat\Stemmer\Enum\StemmerMode;

// 1. Using the main Stemmer manager
$stemmer = new Stemmer([
    new CzechDriver('cs'),
    new EnglishDriver('en'),
]);

echo $stemmer->stem('městě', 'cs'); // "město"
echo $stemmer->stem('working', 'en'); // "work"

// 2. Using drivers directly (optional)
$czechDriver = new CzechDriver('cs');
echo $czechDriver->stem('nejkrásnějšímu', StemmerMode::AGGRESSIVE); // "krásn"

// 3. Custom locale for specific needs (e.g., Slovak)
$skDriver = new CzechDriver('sk');
echo $skDriver->stem('meste', StemmerMode::LIGHT); // "mesto"
```

### Runtime Driver Registration

[](#runtime-driver-registration)

```
use Dompat\Stemmer\Stemmer;
use Your\Custom\CustomDriver;

$stemmer = new Stemmer();
$stemmer->addDriver(new CustomDriver('xy'));

echo $stemmer->stem('word', 'xy');
```

🌍 Supported Languages
---------------------

[](#-supported-languages)

LanguageCodeDriver**Czech**`cs``CzechDriver`**English**`en``EnglishDriver`> **Missing a language?** Feel free to create your own driver by implementing `DriverInterface` and submit a Pull Request!

⚙️ Mode Differences
-------------------

[](#️-mode-differences)

### LIGHT

[](#light)

Suitable for **autocomplete** and **word highlighting** in text. Removes only the most necessary suffixes so the word remains understandable to the user.

### AGGRESSIVE

[](#aggressive)

Suitable for **search indexing**. Reduces the word to its core, increasing search relevance across different word forms.

### Comparison Table

[](#comparison-table)

Word (EN)Light ModeAggressive Mode`declaration``declaration``declar``happiness``happiness``happi``happy``happi``happi``working``work``work`Word (CS)Light ModeAggressive Mode`nejkrásnějšímu``krásnějš``krás``čínští``čínsk``číns``babizna``babizn``bab``městě``měst``měst`🛠 Development and Testing
-------------------------

[](#-development-and-testing)

If you want to contribute to the library, you can run tests and static analysis:

```
# Run tests
vendor/bin/phpunit tests

# Static analysis (PHPStan)
vendor/bin/phpstan analyse
```

📄 License
---------

[](#-license)

This library is licensed under the [MIT License](LICENSE).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance84

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

Total

3

Last Release

81d ago

### Community

Maintainers

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

---

Top Contributors

[![domPatera](https://avatars.githubusercontent.com/u/118061276?v=4)](https://github.com/domPatera "domPatera (5 commits)")

---

Tags

czechenglishindexingnlpphp8searchstemmertext-analysissearchnlpenglishindexingstemmerstemmingczech

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dompat-stemmer/health.svg)

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

###  Alternatives

[elasticsearch/elasticsearch

PHP Client for Elasticsearch

5.3k178.3M943](/packages/elasticsearch-elasticsearch)[teamtnt/tntsearch

A fully featured full text search engine written in PHP

3.2k3.0M28](/packages/teamtnt-tntsearch)[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[solarium/solarium

PHP Solr client

93432.7M98](/packages/solarium-solarium)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15224.3M65](/packages/opensearch-project-opensearch-php)[ripaclub/sphinxsearch

Sphinx Search library provides SphinxQL indexing and searching features

6232.2k3](/packages/ripaclub-sphinxsearch)

PHPackages © 2026

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