PHPackages                             wuzzitor/string-util - 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. wuzzitor/string-util

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

wuzzitor/string-util
====================

Provides a consistent, self-explaining layer to accomplish common string operations.

1.0.0(10y ago)258MITPHPPHP &gt;=5.3.0

Since Jul 19Pushed 10y ago2 watchersCompare

[ Source](https://github.com/Wuzzitor/StringUtil)[ Packagist](https://packagist.org/packages/wuzzitor/string-util)[ RSS](/packages/wuzzitor-string-util/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

StringUtil
==========

[](#stringutil)

[![Build Status](https://camo.githubusercontent.com/3f60f8559a5067068190a7dd14073ddcae521a95679b2c6f1fa5d0664ece23b0/68747470733a2f2f7472617669732d63692e6f72672f57757a7a69746f722f537472696e675574696c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Wuzzitor/StringUtil)[![Coverage Status](https://camo.githubusercontent.com/434b0019de1b8e5360f7a2d16c4b39dac0d43a584c2f3b501c6f91491c4863ad/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f57757a7a69746f722f537472696e675574696c2f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/Wuzzitor/StringUtil?branch=master)

Overview
--------

[](#overview)

This library provides a consistent, self-explaining layer to accomplish string related tasks.

Speaking method names make string operations more readable and reveal the intention clearly. Please compare the following, common snippets regarding readability:

```
// Native:
if (strpos($log, 'failure') !== false) {
    // [...]
}

// With StringUtil:
if (StringUtil::contains($log, 'failure')) {
    // [...]
}

```

In contrast to the built-in PHP string functions, the library provides methods with consistent signatures, which always expect the subject string as first parameter.

### Known Restrictions

[](#known-restrictions)

This library is meant for common, light-weight string operations. It is currently not designed for heavy, complex string tasks such as transparent charset handling.

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

[](#installation)

Add the following to your composer.json (see [getcomposer.org](http://getcomposer.org/)):

```
"require" :  {
    // ...
    "wuzzitor/string-util": "~1.0"
}

```

Concept
-------

[](#concept)

The library provides a single class (`Wuzzitor\StringUtil`), whose static methods are the entry points for all string operations.

All methods are stateless to ensure full testability and to avoid code that is hard to debug.

Usage
-----

[](#usage)

Example:

```
use Wuzzitor\StringUtil;

$filename = 'example.php';
$withoutExtension = StringUtil::removeSuffix($filename, '.php);
// $withoutExtension == 'example'

```

The following signatures show all available operations:

- `StringUtil::startsWith(string $subject, string $prefix) : boolean`
- `StringUtil::endsWith(string $subject, string $suffix) : boolean`
- `StringUtil::contains(string $subject, string $needle) : boolean`
- `StringUtil::containsAny(string $subject, string[] $needles) : boolean`
- `StringUtil::containsAll(string $subject, string[] $needles) : boolean`
- `StringUtil::removePrefix(string $subject, string $prefix) : string`
- `StringUtil::removeSuffix(string $subject, string $suffix) : string`
- `StringUtil::replace(string $subject, string $search, string $replace) : string`
- `StringUtil::replace(string $subject, array $searchReplaceMapping) : string`

License
-------

[](#license)

Code released under [the MIT license](LICENSE).

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

2

Last Release

3978d ago

Major Versions

0.0.1 → 1.0.02015-07-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/6355640b8a36b275627380128860f32f7eb196a5ca559b21ab473af98e7e99f6?d=identicon)[Matthimatiker](/maintainers/Matthimatiker)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wuzzitor-string-util/health.svg)

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

###  Alternatives

[mofodojodino/profanity-filter

Filters out profanities from strings.

69738.2k2](/packages/mofodojodino-profanity-filter)[kocal/biome-js-bundle

A Symfony Bundle to easily download and use Biome.js in your Symfony applications, to lint your front assets without needing Node.js.

31167.7k5](/packages/kocal-biome-js-bundle)[hedii/laravel-date-range

A date range trait with local scope methods for Laravel Eloquent models

2140.6k](/packages/hedii-laravel-date-range)

PHPackages © 2026

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