PHPackages                             mpclarkson/stringy - 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. mpclarkson/stringy

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

mpclarkson/stringy
==================

A PHP Library that provides a consistent api for object oriented manipulation of strings.

v1.0.2(7y ago)62.1k1Apache-2.0PHPPHP &gt;=5.4.0

Since Nov 9Pushed 7y ago2 watchersCompare

[ Source](https://github.com/mpclarkson/stringy)[ Packagist](https://packagist.org/packages/mpclarkson/stringy)[ Docs](https://github.com/mpclarkson/icon-scraper)[ RSS](/packages/mpclarkson-stringy/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (5)Used By (0)

Stringy - Object Oriented Manipulation of Strings in PHP!
=========================================================

[](#stringy---object-oriented-manipulation-of-strings-in-php)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/257701a98bba5c221348f9aec29322afdb7ace9d3c3d8e148982379b96290091/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d70636c61726b736f6e2f737472696e67792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mpclarkson/stringy/?branch=master)[![Build Status](https://camo.githubusercontent.com/208de9af66667dc28674ea967446070723e25ee84126a302e72581bc7f61e560/68747470733a2f2f7472617669732d63692e6f72672f6d70636c61726b736f6e2f737472696e67792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mpclarkson/stringy)

Overview
--------

[](#overview)

Are you stick to death of PHP's inconsistencies in terms on manipulating strings? Well, look no further!

Rather than constantly having to write obtuse code like this to check if a string contains a substring:

```
  strpos($mystring, $substring) !== false ? true : false;
```

You can now do this (and many other things), sensibly!

```
  $string = new String($myString);

  $bool = $string->contains($substring);
```

Yay! :)

Usage
-----

[](#usage)

After applying any methods, the underlying text/string can be accessed as follows:

```
$stringy = new Stringy("mystring");
$stringy->append("is fun", " ");

echo $stringy->string();
//"mystring is fun";
```

Methods
-------

[](#methods)

MethodParametersReturnsstringnilstringtruncate$chars = 50, $appendWith = "..."$thislengthnilintcontains$substringboolstartsWith$substringboolendsWith$substringboolappend$string$thisreversenil$thisuppercasenil$thisuppercaseFirstnil$thislowercasenil$thislowercaseFirstnil$thistitleCasenil$thissentenceCasenil$thistoArray$delimiter = nullarrayapplycallback$thisCheckout the tests for examples of each method.

Requirements
------------

[](#requirements)

- PHP 5.4+

Composer
--------

[](#composer)

Use [Composer](https://getcomposer.org) by adding the following lines in your `composer.json`:

```
    "require": {
        "mpclarkson/stringy": "dev-master"
    },
```

Todos
-----

[](#todos)

- More methods
- Contributions welcome

Credits
-------

[](#credits)

This has been inspired by the beautify string manipulation in Apple's Swift language.

Thanks goes to [Paper Planes Digital Marketing in Brisbane](https://flypaperplanes.co).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~623 days

Total

3

Last Release

2644d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6b954fb04b20736e23779ad9fc68cd3041ecc30aba79f894848abd0984a33e?d=identicon)[hilenium](/maintainers/hilenium)

---

Top Contributors

[![mpclarkson](https://avatars.githubusercontent.com/u/4843821?v=4)](https://github.com/mpclarkson "mpclarkson (12 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

phpstringsswiftstringmanipulationtextobject oriented

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mpclarkson-stringy/health.svg)

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

###  Alternatives

[danielstjules/stringy

A string manipulation library with multibyte support

2.4k26.3M192](/packages/danielstjules-stringy)[voku/stringy

A string manipulation library with multibyte support

1863.9M26](/packages/voku-stringy)[statamic/stringy

A string manipulation library with multibyte support, forked from @statamic

245.0M18](/packages/statamic-stringy)[lolli42/finediff

PHP implementation of a Fine granularity Diff engine

139.8M9](/packages/lolli42-finediff)[d4h/finediff

PHP implementation of a Fine granularity Diff engine

151.5M1](/packages/d4h-finediff)[hallindavid/manny

a package of manipulators that hopefully come in useful for those of us who always forget regex when we need it (manny is short for manipulation)

38109.0k3](/packages/hallindavid-manny)

PHPackages © 2026

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