PHPackages                             timostamm/text-truncation - 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. timostamm/text-truncation

ActiveLibrary

timostamm/text-truncation
=========================

08841PHP

Since Oct 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/timostamm/text-truncation)[ Packagist](https://packagist.org/packages/timostamm/text-truncation)[ RSS](/packages/timostamm-text-truncation/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (1)

PHP Text Truncation Utility
===========================

[](#php-text-truncation-utility)

This utility truncates plain text to a maximum length. It recognizes paragraphs, sentences and words and uses them to cut the text in a smart way.

#### Example

[](#example)

```
// Setup a truncation for a maximum string length of 370 characters.
// Use the Paragraph-Strategy, which tries to find a paragraph
// within the first 370 characters, and falls back to a sentence or
// a word.
$t = new Truncation( 370, Truncation::STRATEGY_PARAGRAPH );

// Apply the truncation
$txt = $t->truncate( $x );
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6364011a12f22cb5046056371bde6170218218c560eddfdc08b4644b7648af78?d=identicon)[timostamm](/maintainers/timostamm)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/timostamm-text-truncation/health.svg)

```
[![Health](https://phpackages.com/badges/timostamm-text-truncation/health.svg)](https://phpackages.com/packages/timostamm-text-truncation)
```

PHPackages © 2026

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