PHPackages                             emanuelecoppola/smartwrap - 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. emanuelecoppola/smartwrap

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

emanuelecoppola/smartwrap
=========================

Smarter wordwrap for PHP

1.0.0(1y ago)6571MITPHPPHP &gt;=7.2CI failing

Since May 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/EmanueleCoppola/smartwrap)[ Packagist](https://packagist.org/packages/emanuelecoppola/smartwrap)[ Fund](https://www.buymeacoffee.com/emanuelecoppola)[ GitHub Sponsors](https://github.com/EmanueleCoppola)[ RSS](/packages/emanuelecoppola-smartwrap/feed)WikiDiscussions main Synced 1mo ago

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

EmanueleCoppola/smartwrap
-------------------------

[](#emanuelecoppolasmartwrap)

I wrote this package because I faced the same problem as in [this](https://stackoverflow.com/q/9815040/5280969) StackOverflow question.

#### Installation

[](#installation)

```
composer require emanuelecoppola/smartwrap
```

#### Usage

[](#usage)

```
use EmanueleCoppola\SmartWrap\SmartWrap;

$sw = new SmartWrap();

$wrapped = $sw->smartwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);

print($wrapped);

// Or by using the global function
$wrapped = smartwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);

print($wrapped);
```

#### Sample input/output

[](#sample-inputoutput)

```
$output = wordwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);
// The output will be ↓
$output == "hello!\nheeeeeeeeeeeeeeereis\naverylongword";

$output = smartwrap('hello! heeeeeeeeeeeeeeereisaverylongword', 20, "\n", true);
// The output will be ↓
$output == "hello! heeeeeeeeeeee\neeereisaverylongword";
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance44

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

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

Total

3

Last Release

533d ago

Major Versions

0.0.2 → 1.0.02024-11-25

PHP version history (2 changes)0.0.1PHP ^7.0.0

1.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12816305?v=4)[Emanuele Coppola](/maintainers/EmanueleCoppola)[@EmanueleCoppola](https://github.com/EmanueleCoppola)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/emanuelecoppola-smartwrap/health.svg)

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

###  Alternatives

[swoole/phpy

Connecting the Python and PHP ecosystems together

6376.4k1](/packages/swoole-phpy)[remotelyliving/doorkeeper

A Feature Toggle

1636.9k](/packages/remotelyliving-doorkeeper)

PHPackages © 2026

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