PHPackages                             sevenecks/string-utils - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. sevenecks/string-utils

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

sevenecks/string-utils
======================

A collection of string utilities for PHP, loosely based on the LambdaMOO $string\_utils package.

0.1.1(7y ago)06.3k↓25%3MITPHPPHP &gt;=5.4

Since Dec 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/SevenEcks/string-utils)[ Packagist](https://packagist.org/packages/sevenecks/string-utils)[ Docs](https://github.com/sevenecks)[ RSS](/packages/sevenecks-string-utils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (18)Used By (3)

StringUtils
===========

[](#stringutils)

A set of common string functions, loosely based on LambdaMOO $string\_utils. It uses [sevenecks/ansi](https://github.com/SevenEcks/ansi) to add color where applicable though you can pass your own colorizer in via dependency injection.

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

[](#installation)

Via Composer

```
composer require sevenecks/string-utils
```

Usage
-----

[](#usage)

```
require_once __DIR__ . '/../vendor/autoload.php';
use SevenEcks\StringUtils\StringUtils;
use SevenEcks\Ansi\Colorize;

$su = new StringUtils;
$test_string = 'This is a test';
// echo out test string
$su->tell($test_string);
$su->setLineLength(10);
// echo out a string, ignores line len
$su->tell($su->colorize->red("This is a test of a long red string!"));
$su->setSplitMidWord(true);
// echo using line length and color color
$su->tell($su->colorize->red($su->wordWrap("This is a test of a long blue word wrapped string which breaks mid word!")));
$su->setSplitMidWord(false);
// echo using length and color color
$su->tell($su->colorize->blue($su->wordWrap("This is a test of a long blue word wrapped string which breaks at a word!")));
// set the line length break string to br instead of default of \n
$su->setBreakString("");
$su->tell($su->colorize->red($su->wordWrap("This is a test of a long red string!")));
$su->tell("Not colored.");
// mass colorize a string wrapped by line
$su->tell_lines($su->massColor($su->lineWrap("This is a test of a long line wrapped red strings!"), 'blue'));
// break at specific linelen
$su->tell_lines($su->lineWrap('123456789123456789123456789'));
// formatting of left, right, and center
$su->tell($su->left("TEST", 10) . $su->left("TEST1", 10));
$su->tell($su->right("TEST", 10) . $su->right("TEST1", 10));
$su->tell($su->center("TEST", 10) . $su->center("TEST1", 10));
// update line len
$su->setLineLength(180);
// center
$su->tell($su->center("CENTER NO ARGS"));
$su->tell($su->center("CENTER W/ ARGS", 30));
// alerts crits and warnings for debugging
$su->alert("This is an alert!");
$su->warning("This is a warning");
$su->critical("This is critical!");
// using tostr to combine args into a string
$su->tell($su->tostr($su->center("THIS EXAMPLE", 10), ' ', $su->center("USES TOSTR", 10), ' ', 1,2,3));
$su->tell($su->tostr('1',2,'3','asdf',['a', 'b' => 'c', 1]));
```

[![Example Output](https://github.com/SevenEcks/string-utils/raw/master/images/example.png "Example Output")](https://github.com/SevenEcks/string-utils/blob/master/images/example.png)

Change Log
----------

[](#change-log)

Please see [Change Log](CHANGELOG.md) for more information.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

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

Recently: every ~52 days

Total

17

Last Release

2769d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/963368d2aa1a4a1bf29571edf1377016ec16104a567abd89075b78f0edbf0925?d=identicon)[sevenecks](/maintainers/sevenecks)

---

Top Contributors

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

---

Tags

formattinglambdamoologgingphpstringterminalcliconsolecommand-linestringshellformattinglambdamoo

### Embed Badge

![Health badge](/badges/sevenecks-string-utils/health.svg)

```
[![Health](https://phpackages.com/badges/sevenecks-string-utils/health.svg)](https://phpackages.com/packages/sevenecks-string-utils)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[jbzoo/utils

Collection of PHP functions, mini classes and snippets for everyday developer's routine life.

8321.5M36](/packages/jbzoo-utils)[kevinlebrun/colors.php

Colors for PHP CLI scripts

3426.7M45](/packages/kevinlebrun-colorsphp)[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k48](/packages/nunomaduro-laravel-console-menu)[nunomaduro/laravel-console-task

Laravel Console Task is a output method for your Laravel/Laravel Zero commands.

2582.1M11](/packages/nunomaduro-laravel-console-task)

PHPackages © 2026

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