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

33

—

LowBetter than 74% of packages

Maintenance46

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

529d 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://www.gravatar.com/avatar/cc739be46a199e65a4a7f108384767e58cfa61cee482d24a6ec7929ab50394e4?d=identicon)[EmanueleCoppola](/maintainers/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

[tatter/menus

Dynamic menus for CodeIgniter 4

1713.8k1](/packages/tatter-menus)[llm/mcp-server

PHP SDK for building MCP servers

431.1k](/packages/llm-mcp-server)[asorasoft/chhankitek

Convert from AD (Anno Domini) to Lunar (Chhankitek) format.

104.2k](/packages/asorasoft-chhankitek)[mohammedmanssour/super-simple-dto

Creating data transfer objects with the power of php objects

122.8k1](/packages/mohammedmanssour-super-simple-dto)

PHPackages © 2026

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