PHPackages                             apie/count-words - 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. apie/count-words

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

apie/count-words
================

Composer package of the apie library: count words

1.0.0.x-dev(4mo ago)07.0k4MITPHPPHP &gt;=8.3

Since Mar 18Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/apie-lib/count-words)[ Packagist](https://packagist.org/packages/apie/count-words)[ RSS](/packages/apie-count-words/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (4)

[![](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)

count-words
===========

[](#count-words)

[![Latest Stable Version](https://camo.githubusercontent.com/d8faa65d3965d7ced60821404faca0dbf08bec28ba21b5e9410ee5f6432ddb6b/68747470733a2f2f706f7365722e707567782e6f72672f617069652f636f756e742d776f7264732f76)](https://packagist.org/packages/apie/count-words) [![Total Downloads](https://camo.githubusercontent.com/87543efa08886dfc4b4645780ed67e7feeff31f695d2e7fd85bce3ec93d31c9e/68747470733a2f2f706f7365722e707567782e6f72672f617069652f636f756e742d776f7264732f646f776e6c6f616473)](https://packagist.org/packages/apie/count-words) [![Latest Unstable Version](https://camo.githubusercontent.com/0b47e7f996f8c042823e7039a416dc1d803bc933eaf039b100d33492022f53b4/68747470733a2f2f706f7365722e707567782e6f72672f617069652f636f756e742d776f7264732f762f756e737461626c65)](https://packagist.org/packages/apie/count-words) [![License](https://camo.githubusercontent.com/a8f927fd6619f7151da6f69d470de6931d2e5255a4b33b6fa41b0fc09fdb19ff/68747470733a2f2f706f7365722e707567782e6f72672f617069652f636f756e742d776f7264732f6c6963656e7365)](https://packagist.org/packages/apie/count-words) [![PHP Composer](https://camo.githubusercontent.com/31c58fcbb506839f38eab4920a06a638e4eb7033d7c4771345dcd4cddf782ce8/68747470733a2f2f617069652d6c69622e6769746875622e696f2f70726f6a656374436f7665726167652f636f7665726167652d636f756e742d776f7264732e737667)](https://apie-lib.github.io/projectCoverage/count-words/index.html)

[![PHP Composer](https://github.com/apie-lib/count-words/actions/workflows/php.yml/badge.svg?event=push)](https://github.com/apie-lib/count-words/actions/workflows/php.yml)

This package is part of the [Apie](https://github.com/apie-lib) library. The code is maintained in a monorepo, so PR's need to be sent to the [monorepo](https://github.com/apie-lib/apie-lib-monorepo/pulls)

Documentation
-------------

[](#documentation)

This small package contains a class to count words in a text. All words are returned lowercase.

Usage

```
use Apie\CountWords\WordCounter;

var_dump(WordCounter::countFromString('This is the text with many words like the or and'));
```

This will echo:

```
array(10) {
  ["this"]=>
  int(1)
  ["is"]=>
  int(1)
  ["the"]=>
  int(2)
  ["text"]=>
  int(1)
  ["with"]=>
  int(1)
  ["many"]=>
  int(1)
  ["words"]=>
  int(1)
  ["like"]=>
  int(1)
  ["or"]=>
  int(1)
  ["and"]=>
  int(1)
}

```

It also supports reading (large) files as long the indexing does still fit in memory:

```
use Apie\CountWords\WordCounter;

var_dump(WordCounter::countFromResource(fopen('large_file.txt', 'r')));
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance75

Regular maintenance activity

Popularity20

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~287 days

Total

2

Last Release

138d ago

### Community

Maintainers

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

---

Top Contributors

[![pjordaan](https://avatars.githubusercontent.com/u/2209895?v=4)](https://github.com/pjordaan "pjordaan (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/apie-count-words/health.svg)

```
[![Health](https://phpackages.com/badges/apie-count-words/health.svg)](https://phpackages.com/packages/apie-count-words)
```

PHPackages © 2026

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