PHPackages                             stahiralijan/stringer - 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. stahiralijan/stringer

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

stahiralijan/stringer
=====================

🧵A PHP String manipulation library

2.1.2(3y ago)059MITPHPPHP ^8.0

Since Feb 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/stahiralijan/stringer)[ Packagist](https://packagist.org/packages/stahiralijan/stringer)[ RSS](/packages/stahiralijan-stringer/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

Stringer {#readme}
==================

[](#stringer-readme)

[![Packagist](https://camo.githubusercontent.com/3b1075063665b86e815cee1e76b1ba0b04b72c02033a52376d5a4ba87ddd9b6e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737461686972616c696a616e2f737472696e6765722e737667)](https://packagist.org/packages/stahiralijan/stringer)[![Packagist](https://camo.githubusercontent.com/a29a85bb31cf8821739bb8e3550d01fce1abab4bb2031423f6dec5ff32f5c7f2/68747470733a2f2f706f7365722e707567782e6f72672f737461686972616c696a616e2f737472696e6765722f642f746f74616c2e737667)](https://packagist.org/packages/stahiralijan/stringer)[![Packagist](https://camo.githubusercontent.com/1f0c496ba4c78be846ab14522b71b05283813d73b369d4e2fc3f8066abcbc3d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f737461686972616c696a616e2f737472696e6765722e737667)](https://packagist.org/packages/stahiralijan/stringer)

This is a string manipulation library gives you convenience of string operations.

Dependencies
------------

[](#dependencies)

- PHP8+
- PHP mbstring (Multi-byte string) extension

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

[](#installation)

Install via composer

```
composer require stahiralijan/stringer
```

### Register Service Provider

[](#register-service-provider)

**Note! This and next step are optional if you use laravel&gt;=5.5 with package auto discovery feature.**

Add service provider to `config/app.php` in `providers` section

```
Stahiralijan\Stringer\ServiceProvider::class,
```

### Register Facade

[](#register-facade)

Register package facade in `config/app.php` in `aliases` section

```
Stahiralijan\Stringer\Facades\Stringer::class,
```

### Publish Configuration File

[](#publish-configuration-file)

```
php artisan vendor:publish --provider="Stahiralijan\Stringer\ServiceProvider" --tag="config"
```

---

Available Methods
=================

[](#available-methods)

Following methods are provided:

MethodReturnsDescription`left($length)`**string**Returns a string containing a specified number of characters from the left side of a string.`right($length)`**string**Returns a string containing a specified number of characters from the right side of a string.`has($needle, $case_insensitive = FALSE)`**bool**Tests if string has sub-string.`toUpper()`**string**Returns the upper-case version of the string.`toLower()`**string**Returns the lower-case version of the string.`toTitle()`**string**Returns the lower-case version of the string.`substrUpper($start = 0, $length = 1)`**string**Returns the upper-case version of the sub-string.`substrLower($start = 0, $length = 1)`**string**Returns the lower-case version of the sub-string.`capitalize()`**string**Returns a capitalized version of the string.`titleCase()`**string**Returns a title-case version of the string.`toCharArray($length = 1)`**array**Returns array of characters of the string.`toWordsArray()`**array**Returns array of words of the string.`substring($start = 0, $length = NULL)`**string**Returns the sub-string of the string.`before($search, $includeWord = FALSE)`**string**Returns string before the supplied word.`after($search, $includeWord = FALSE)`**string**Returns string after the supplied word`between($start, $end, $includeWords = FALSE)`**string**Returns string specified betweet `$start` and `$end``startsWith($search)`**bool**Tests if the string starts with the supplied string.`endsWith($search)`**string**Tests if the string ends with the supplied string.`reverse()`**string**Returns a reversed version of the string.`function reverseCase()`**string**Returns a reversed-case of the string.`reverseOrder()`**string**Reverses the order of the string.`toSlug($delimiter = '-')`**string**Returns a slugged version of the string.`simplify()`**string**Removes the special characters from the string.`replaceAll($search, $replacement)`**string**Returns a string after replacing all occurrences of the supplied string.`replaceFirst($search, $replacement)`**string**Returns a string after replacing the first occurrence of the supplied string.`replaceLast($search, $replacement)`**string**Returns a string after replacing the last occurrence of the supplied string.`replaceN($search, $replacement, $numbers)`**string**Returns a string after replacing the `N` occurrence of the supplied string.`indexOf($search, $insensitive = FALSE)`**int / bool**Returns the index of the supplied string in the string.`lastIndexOf($search, $insensitive = FALSE)`**int / bool**Returns the last index of the supplied string in the string.`countWords()`**int**Returns number of words in the string separated by a space `' '`.`contains($search)`**bool**Tests if string has sub-string.`equals($value)`**bool**Tests of the string is equal to the provided string.`insertAt($value, $position)`**string**Insert the $value at the $position.`leftTrim()`**string**Returns Left-trimmed version of the string.`rightTrim()`**string**Returns Right-trimmed version of the string.`trim()`**string**Returns a trimmed version of the string.`length()`**int**Returns length of the string.`printf($format)`**void**Prints the string with supplied format.`limit($limit = 100, $terminator = '...', $includeTerminator = FALSE)`**string**Truncate and limit the string.`frequency($search, $case_insensitive = true)`**int**Counts the times supplied string appears in the string.`occurances($search, $case_insensitive = true)`**int**Counts the times supplied string appears in the string.`rightPad($padWith, $length = 1)`**string**Returns a padded string with right-side padded with $length number of `$padWith`.`leftPad($padWith, $length = 1)`**string**Returns a padded string with left-side padded with $length number of `$padWith`.`pad($padWith, $length = 1)`**string**Returns a padded string with both sides padded with $length number of `$padWith`.Security
--------

[](#security)

If you discover any security related issues, please email.

Credits
-------

[](#credits)

- [All contributors](https://github.com/stahiralijan/stringer/graphs/contributors)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Total

3

Last Release

1306d ago

Major Versions

1.0.0 → 2.0.02022-10-17

PHP version history (2 changes)1.0.0PHP &gt;=7.0

2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7cbb0c9bdeffd63fcb5301d5691d38d5bf9287ba687fb28345e90bd531daaf53?d=identicon)[stahiralijan](/maintainers/stahiralijan)

---

Top Contributors

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

---

Tags

phpphpstringstringer

### Embed Badge

![Health badge](/badges/stahiralijan-stringer/health.svg)

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

###  Alternatives

[coduo/php-to-string

Simple library that converts PHP value into strings

27112.7M10](/packages/coduo-php-to-string)[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)
