PHPackages                             org\_heigl/textstatistics - 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. org\_heigl/textstatistics

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

org\_heigl/textstatistics
=========================

Get statistics from a given text

0.2.1(8y ago)112.3k[1 issues](https://github.com/heiglandreas/TextStatistics/issues)[1 PRs](https://github.com/heiglandreas/TextStatistics/pulls)MITPHPPHP ^7.0CI failing

Since Mar 20Pushed 5y ago2 watchersCompare

[ Source](https://github.com/heiglandreas/TextStatistics)[ Packagist](https://packagist.org/packages/org_heigl/textstatistics)[ RSS](/packages/org-heigl-textstatistics/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (3)Versions (10)Used By (0)

Text-Statistics
===============

[](#text-statistics)

Calculate text-statistics including Sylables, Flesch-Reading-Ease (english and german) and such things.

[![Build Status](https://camo.githubusercontent.com/21cda4b846eb5ff806e3e860a81aa2a881d78471771ee5d501d2a1f7b48689f7/68747470733a2f2f7472617669732d63692e6f72672f686569676c616e64726561732f54657874537461746973746963732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/heiglandreas/TextStatistics)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f6720843dc9d47ccae4ca80e03b735aa242f6b0e8b407ee669f92dd521e7cd7a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f686569676c616e64726561732f54657874537461746973746963732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/heiglandreas/TextStatistics/?branch=master)[![Code Climate](https://camo.githubusercontent.com/0501eeb162c1a9ad6b507d9e047f72620c9edfc72fed5e6f95a7c6a6e4d20908/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f686569676c616e64726561732f54657874537461746973746963732f6261646765732f6770612e737667)](https://codeclimate.com/github/heiglandreas/TextStatistics)[![StyleCI](https://camo.githubusercontent.com/1018bdf0e6209344f94a5940124daebf7df6c8f5033c564819873afb878bf191/68747470733a2f2f7374796c6563692e696f2f7265706f732f37303734303431312f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/70740411)[![Coverage Status](https://camo.githubusercontent.com/47f6d8dd3fb1e328146c3ce2cf230edb5921340e27096b80b686dbc4ac65100d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f686569676c616e64726561732f54657874537461746973746963732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/heiglandreas/TextStatistics?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/d11015bff70ee7000c17e557e543140ff55ef19a676ec484e4c93bbeae5972bb/68747470733a2f2f706f7365722e707567782e6f72672f6f72675f686569676c2f74657874737461746973746963732f762f737461626c65)](https://packagist.org/packages/org_heigl/textstatistics)[![Total Downloads](https://camo.githubusercontent.com/ff078ac6efc208a43555c8d48d13b68309ad9a3116b7b6af19d2d410bba45cdc/68747470733a2f2f706f7365722e707567782e6f72672f6f72675f686569676c2f74657874737461746973746963732f646f776e6c6f616473)](https://packagist.org/packages/org_heigl/textstatistics)[![License](https://camo.githubusercontent.com/e04a685a11642a1271ced170a1952d6cbcba7f6dec2132dd4cc1acb0e742fd6e/68747470733a2f2f706f7365722e707567782e6f72672f6f72675f686569676c2f74657874737461746973746963732f6c6963656e7365)](https://packagist.org/packages/org_heigl/textstatistics)[![composer.lock](https://camo.githubusercontent.com/24cd9e6c2278abaabacd2855b9743247e681c11e9f16d59354653a309edb3ff0/68747470733a2f2f706f7365722e707567782e6f72672f6f72675f686569676c2f74657874737461746973746963732f636f6d706f7365726c6f636b)](https://packagist.org/packages/org_heigl/textstatistics)

Why
---

[](#why)

The one other implementation [davechild/textstatistics](https://packagist.org/packages/davechild/textstatistics)sadly only implements statistics for english texts. That sadly didn't work for texts with f.e. german umlauts. So I decided to implement some of the algorithms again using work I already did for a [hyphenator](https://packagist.org/packages/org_heigl/hyphenator).

That's why f.e. the syllable-calculation differs.

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

[](#installation)

TextStatistics is best installed using [composer](https://getcomposer.org)

```
$ composer require org_heigl/textstatistics
```

Usage
-----

[](#usage)

The different Calculators all implement a common `CalculatorInterface`and therefore all provide a `calculate`-Method that expects a `Text`-Object containing the Text to be calculated.

Currently these Statistics are avalable:

- Average Sentence Length
- Average Syllables per word
- Character-Count (including Whitespace)
- Character-Count (excluding whitespace)
- Flesch-Kincaid Grade Level
- Flesch-Reading-Ease for English texts
- Flesch-Reading-Ease for German texts
- Flesch-Reading-Ease School-Grade measurement
- Sentence-Count
- Max Syllables in Sentence
- Max Words in Sentence
- Syllable-Count
- Wiener Sachtext-Formel 1, 2, 3 and 4
- Word-Count
- Max Syllables in Word
- Number of words with minimum N characters
- Percentage of Words with minimum N characters
- Number of words with minimum N syllables
- Percentage of words with minimum N syllables
- Number of words with only N syllables
- Percentage of words with only N syllables

There are Factory-Methods for each statistic available, so getting one of the statistics requires the following line of code:

```
$text = new \Org_Heigl\TextStatistics\Text($theText);
$wordCount =\Org_Heigl\TextStatistics\Service\WordCounterFactory::getCalculator()->calculate($text);
$fleschReadingEase = /Org_Heigl\TextStatistics\Service\FleschReadingEaseCalculatorFactory::getCalculator()->calculate($text);
```

You can also add multiple Calculators to the TextStatisticsGenerator and retrieve multiple Statistics in one go like this:

```
$text = new \Org_Heigl\TextStatistics\Text($theText);

$statGenerator = new \Org_Heigl\TextStatistics\TextSTatisticsGenerator();
$statGenerator->add('wordCount', \Org_Heigl\TextStatistics\Service\WordCounterFactory::getCalculator());
$statGenerator->add('flesch', \Org_Heigl\TextStatistics\Service\FleschReadingEaseCalculatorFactory::getCalculator());

print_R($statGenerator->calculate($text));

// array(
//    'wordCount' => xx,
//    'flesch' => yy,
// )
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97% 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 ~111 days

Total

4

Last Release

3005d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ae5183aaad2bc7453230704bd6991dc6ccbcd6e775c6a29efdc94350a69f247?d=identicon)[heiglandreas](/maintainers/heiglandreas)

---

Top Contributors

[![heiglandreas](https://avatars.githubusercontent.com/u/91998?v=4)](https://github.com/heiglandreas "heiglandreas (32 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/org-heigl-textstatistics/health.svg)

```
[![Health](https://phpackages.com/badges/org-heigl-textstatistics/health.svg)](https://phpackages.com/packages/org-heigl-textstatistics)
```

###  Alternatives

[jolicode/jolitypo

Microtypography fixer for the web.

3471.1M5](/packages/jolicode-jolitypo)[bentools/string-combinations

A simple, low-memory footprint function to generate all string combinations from a series of characters.

31197.8k](/packages/bentools-string-combinations)

PHPackages © 2026

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