PHPackages                             cruiser13/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. cruiser13/textstatistics

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

cruiser13/textstatistics
========================

PHP package to measure the readability of text according to various algorithms.

1.0.1(11y ago)017BSD-2-ClausePHPPHP &gt;=5.3.0

Since Sep 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Cruiser13/Text-Statistics)[ Packagist](https://packagist.org/packages/cruiser13/textstatistics)[ Docs](https://github.com/DaveChild/Text-Statistics)[ RSS](/packages/cruiser13-textstatistics/feed)WikiDiscussions master Synced today

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

PHP Text Statistics
===================

[](#php-text-statistics)

Fork of the default DaveChild/Text-Statistics repository + german language function

[![Build Status](https://camo.githubusercontent.com/cf79b179932fd05506264d42cac3829458d8a940d02a8690d4fd059f26941f8d/68747470733a2f2f7472617669732d63692e6f72672f446176654368696c642f546578742d537461746973746963732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/DaveChild/Text-Statistics) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/46779f54ca81c232a21bf785c2bbcb3ae4207c9a9e012f54edd16a3d27ab9a19/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f446176654368696c642f546578742d537461746973746963732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/DaveChild/Text-Statistics/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/a789ecc83815cd7ef87ba27ad0dba5cf6cdceb110f6c4b6d83a49d5afd25bb58/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f446176654368696c642f546578742d537461746973746963732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/DaveChild/Text-Statistics/?branch=master)

The PHP Text Statistics class will help you to indentify issues with your website content, especially with readability.

It allows you to measure the readability of text using common scoring systems, including:

- Flesch Kincaid Reading Ease
- Flesch Kincaid Grade Level
- Gunning Fog Score
- Coleman Liau Index
- SMOG Index
- Automated Reability Index
- Dale-Chall Readability Score
- Spache Readability Score

One of the biggest challenges with measuring text readability is the counting of syllables, which can be tricky to work out. There are rules in the Statistics class for working out the syllable count of words, and a large list of words to test these rules against.

Please feel free to add to the test word list, especially if you can find words whose syllable count is not correctly calculated (even more especially if you can also add code to the class so your word is correctly handled!).

Homographs are going to be impossible to calculate as they depend on context (i.e., "he moped around the house", "she rode her moped to school), but there are few enough of these not to be a concern. There is a by-no-means-comprehensive list of these in the resources folder.

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

[](#installation)

### Using Composer

[](#using-composer)

```
    {
        "require": {
            "davechild/textstatistics": "1.*"
        }
    }
```

> If using a version of PHP &lt; 7.2, specify version 1.0.2.

### Measuring Readability

[](#measuring-readability)

```
use DaveChild\TextStatistics as TS;
$textStatistics = new TS\TextStatistics;
$text = 'The quick brown fox jumped over the lazy dog.';
echo 'Flesch-Kincaid Reading Ease: ' . $textStatistics->fleschKincaidReadingEase($text);
```

### More Text Shenanigans!

[](#more-text-shenanigans)

Included with this package are several classes with static methods which can be called independently. If required, you can pass a text encoding to these methods as a second parameter.

#### Pluralise and Singularise Words

[](#pluralise-and-singularise-words)

```
echo DaveChild\TextStatistics\Pluralise::getPlural('banana'); // bananas
echo DaveChild\TextStatistics\Pluralise::getSingular('bananas'); // banana
```

#### Count Syllables

[](#count-syllables)

```
echo DaveChild\TextStatistics\Syllables::syllableCount('banana'); // 3
```

#### Letter, Sentence, Word Counts

[](#letter-sentence-word-counts)

```
echo DaveChild\TextStatistics\Text::textLength('I ate a banana.'); // 15
echo DaveChild\TextStatistics\Text::letterCount('I ate a banana.'); // 11
echo DaveChild\TextStatistics\Text::wordCount('I ate a banana.'); // 4
echo DaveChild\TextStatistics\Text::sentenceCount('I ate a banana.'); // 1
```

Useful Links
------------

[](#useful-links)

**Homepage and Live Version**

**JavaScript Port**

**License**

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 69.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 ~297 days

Total

4

Last Release

3424d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2771909?v=4)[Lennart Fries](/maintainers/Cruiser13)[@Cruiser13](https://github.com/Cruiser13)

---

Top Contributors

[![DaveChild](https://avatars.githubusercontent.com/u/53308?v=4)](https://github.com/DaveChild "DaveChild (64 commits)")[![jrfnl](https://avatars.githubusercontent.com/u/663378?v=4)](https://github.com/jrfnl "jrfnl (12 commits)")[![Cruiser13](https://avatars.githubusercontent.com/u/2771909?v=4)](https://github.com/Cruiser13 "Cruiser13 (5 commits)")[![DominicVonk](https://avatars.githubusercontent.com/u/3958086?v=4)](https://github.com/DominicVonk "DominicVonk (3 commits)")[![migurski](https://avatars.githubusercontent.com/u/58730?v=4)](https://github.com/migurski "migurski (1 commits)")[![mryand](https://avatars.githubusercontent.com/u/256007?v=4)](https://github.com/mryand "mryand (1 commits)")[![repat](https://avatars.githubusercontent.com/u/516807?v=4)](https://github.com/repat "repat (1 commits)")[![Aaron3](https://avatars.githubusercontent.com/u/2073168?v=4)](https://github.com/Aaron3 "Aaron3 (1 commits)")[![richtom80](https://avatars.githubusercontent.com/u/2042921?v=4)](https://github.com/richtom80 "richtom80 (1 commits)")[![bryant1410](https://avatars.githubusercontent.com/u/3905501?v=4)](https://github.com/bryant1410 "bryant1410 (1 commits)")[![DrDub](https://avatars.githubusercontent.com/u/315403?v=4)](https://github.com/DrDub "DrDub (1 commits)")[![garymarkfuller](https://avatars.githubusercontent.com/u/6162988?v=4)](https://github.com/garymarkfuller "garymarkfuller (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[smile/module-store-locator

Smile Store Locator

50527.7k4](/packages/smile-module-store-locator)[digital-creative/resource-navigation-link

Create links to internal or external resources.

1047.4k](/packages/digital-creative-resource-navigation-link)[invaders-xx/filament-nested-list

Nested lists layout plugin for Filament

104.8k](/packages/invaders-xx-filament-nested-list)[ghost/dcat-config

配置管理

112.3k](/packages/ghost-dcat-config)

PHPackages © 2026

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