PHPackages                             awssat/str-helper - 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. awssat/str-helper

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

awssat/str-helper
=================

A flexible &amp; powerful string manipulation helper for PHP

2.1(8y ago)441117MITPHPPHP ~7.0

Since Nov 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/awssat/str-helper)[ Packagist](https://packagist.org/packages/awssat/str-helper)[ Docs](https://github.com/awssat/str-helper)[ RSS](/packages/awssat-str-helper/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (1)Versions (9)Used By (0)

str-helper
==========

[](#str-helper)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e7c51f9632f2593c58a8c1fa480ec489643f648d02b35e1c77ad41afa5247e21/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6177737361742f7374722d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/awssat/str-helper)[![StyleCI](https://camo.githubusercontent.com/ab27c30826205e57cc1140f38f80cd9dc377b3283c8362677c6c26ce62053d2d/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131313332393930352f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/111329905)[![Build Status](https://camo.githubusercontent.com/4bc43d62d4ec5a70f2a5a8f927abba9ff9ef37a1887cfb2195aeb46fbb69a6fa/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6177737361742f7374722d68656c7065722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/awssat/str-helper)

⚡️ A flexible, simple &amp; yet powerful string manipulation helper for PHP. It gives you the magic of method chaining and it's easier and shorter to be included in views. It Supports most of [PHP built-in strings functions](http://php.net/manual/en/book.strings.php) (and other useful methods like: contains, equal, append, prepend ...).

```
str('Hi World')->replace(' ', '+')->lower();
```

Why use this instead of other string maniplulation packages ?
-------------------------------------------------------------

[](#why-use-this-instead-of-other-string-maniplulation-packages-)

This is a wrapper for PHP default string functions, to provide a very poweful method chaining and conditions. You don't have to learn new methods names, just use PHP functions names that you know.

Install/Use
-----------

[](#installuse)

You can install the package via composer locally in your project folder:

```
$ composer require awssat/str-helper
```

After installing it, just start using `StrHelper` class, or simply the helper function `str()`:

Examples
--------

[](#examples)

```
str('Hi Hello')->strReplace(' ', '-');
>> hi-hello
```

```
str('Hi Hello')->prepend('[')->append(']');
>> [Hi Hello]
```

In case you want an explicit string value for conditions, use "get":

```
if(str('Hi')->lower->get() == 'hi') {
        echo 'yes';
}
>> yes
```

There is a "tap" method:

```
str('LINK.COM')->tap(function($v){ print($v); })->lower();
>> LINK.COM
```

for callbacks use "do" method:

```
str('link.com')->do(function($string){
        return strip_tags($string);
});
>> link.com
```

or:

```
str('link.com')->do(function(){
        $this->stripTags();
});
>> link.com
```

you may notice using camelCase instead of snake\_case for method name works too.

You can also use conditions, if(..), else(), endif()

```
str('hi')
            ->ifContains('hi')
            ->upper();
>> HI
```

if can take an anonymous function

```
str('hi')
            ->if(function(){
                    return $this->contains('hi');
            })
            ->upper();
>> HI
```

All methods are availabe to be called statically, as:

```
StrHelper::capitalize('life');
```

or using str() function.

```
str()::capitalize('nomad');
```

**\[UTF-8 Support\] If mbstring library is installed and you call a strpos function, mb\_strpos will be called instead.**

Tests
-----

[](#tests)

Simply use:

```
$ composer test
```

Credits
-------

[](#credits)

- [Abdulrahman M.](https://github.com/abdumu)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.9% 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 ~16 days

Recently: every ~27 days

Total

8

Last Release

2982d ago

Major Versions

1.5 → 2.02018-03-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/d63ba92836f56059bfec22fead606b313704937afa4e27b67ed16043d7b07968?d=identicon)[abdumu](/maintainers/abdumu)

---

Top Contributors

[![abdumu](https://avatars.githubusercontent.com/u/114794?v=4)](https://github.com/abdumu "abdumu (47 commits)")[![Dylan-DPC](https://avatars.githubusercontent.com/u/99973273?v=4)](https://github.com/Dylan-DPC "Dylan-DPC (1 commits)")[![jxlwqq](https://avatars.githubusercontent.com/u/2421068?v=4)](https://github.com/jxlwqq "jxlwqq (1 commits)")

---

Tags

chainable-methodscomposer-packageflexiblemethod-chainingpackagistphppipestrstr-helperstring-manipulationlaravelhelperstringmanipulationstr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/awssat-str-helper/health.svg)

```
[![Health](https://phpackages.com/badges/awssat-str-helper/health.svg)](https://phpackages.com/packages/awssat-str-helper)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[pragmarx/ia-str

Laravel Illuminate Agnostic Str

523.5M5](/packages/pragmarx-ia-str)[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)

38103.3k2](/packages/hallindavid-manny)[jasonlam604/stringizer

Stringizer is a PHP string manipulation library with support for method chaining and multibyte handling

35110.5k1](/packages/jasonlam604-stringizer)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)

PHPackages © 2026

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