PHPackages                             rkr/strings - 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. rkr/strings

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

rkr/strings
===========

0.0.1(12y ago)240MITPHPPHP &gt;= 5.3

Since Mar 18Pushed 1y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Consistent multibyte function library for strings
=================================================

[](#consistent-multibyte-function-library-for-strings)

Design-goals
------------

[](#design-goals)

- Consistent interface.
- All names are lowerCamelCase.
- Required parameters are always at the beginning.
- Homogeneous parameters follow conventions: $haystack is always before $needle.
- Proper null handling.

Functions
---------

[](#functions)

- **at**
    \\rkr\\str\\**at**(*string|null* **string**, *int|null* **position**): *string|null*
    *Get the character at the specified position in a string.*
- **bagDistance**
    \\rkr\\str\\**bagDistance**(*string|null* **string1**, *string|null* **string2**): *int|null*
    *Calculate the bag distance between two strings.*
- **capitalize**
    \\rkr\\str\\**capitalize**(*string|null* **string**): *string|null*
    *Capitalize the first character of the string.*
- **capitalizeWords**
    \\rkr\\str\\**capitalizeWords**(*string|null* **string**): *string|null*
    *Capitalize the first letter of each word in a string.*
- **characters**
    \\rkr\\str\\**characters**(*string|null* **string**): *array|null*
    *Get the Unicode characters of a string.*
- **chunk**
    \\rkr\\str\\**chunk**(*string|null* **string**, *int* **length**): *array|null*
    *Splits a string into chunks of the given length.*
- **contains**
    \\rkr\\str\\**contains**(*string|null* **haystack**, *string|null* **needle**): *bool*
    *Check if a string contains another string.*
- **duplicate**
    \\rkr\\str\\**duplicate**(*string|null* **string**, *int* **times**): *string|null*
    *Duplicate a string a given number of times.*
- **endsWith**
    \\rkr\\str\\**endsWith**(*string|null* **haystack**, *string|null* **needle**): *bool*
    *Checks if the haystack ends with the needle.*
- **equals**
    \\rkr\\str\\**equals**(*string|null* **string1**, *string|null* **string2**): *bool*
    *Asserts that a string is equal to another string.*
- **first**
    \\rkr\\str\\**first**(*string|null* **string**): *string|null*
    *Get the first character of a string.*
- **indexOf**
    \\rkr\\str\\**indexOf**(*string|null* **haystack**, *string|null* **needle**, *int* **offset**): *int|null*
    *Finds the position of the first occurrence of a substring in a string.*
- **jaroDistance**
    \\rkr\\str\\**jaroDistance**(*string|null* **string1**, *string|null* **string2**): *float|null*
    *Calculate the Jaro distance between two strings.*
- **last**
    \\rkr\\str\\**last**(*string|null* **string**): *string|null*
    *Get the last character of a string.*
- **lastIndexOf**
    \\rkr\\str\\**lastIndexOf**(*string|null* **haystack**, *string|null* **needle**, *int* **offset**): *int|null*
    *Find the last occurrence of a string in another string.*
- **length**
    \\rkr\\str\\**length**(*string|null* **string**): *int|null*
    *Get the length of the string.*
- **lower**
    \\rkr\\str\\**lower**(*string|null* **string**): *string|null*
    *Converts a string to lowercase.*
- **matches**
    \\rkr\\str\\**matches**(*string|null* **string**, *string|null* **pattern**): *bool*
    *Check if a string matches a regular expression pattern.*
- **myersDifference**
    \\rkr\\str\\**myersDifference**(*string|null* **string1**, *string|null* **string2**): *int|null*
    *Calculate the Myers difference between two strings.*
- **normalize**
    \\rkr\\str\\**normalize**(*string|null* **string**, *string* **form**): *string|null*
    *Normalize a string using a specified normalization form.*
- **padLeading**
    \\rkr\\str\\**padLeading**(*string|null* **string**, *int* **length**, *string|null* **substring**): *string|null*
    *Pads the given string on the left side to the specified length with the specified character.*
- **padTrailing**
    \\rkr\\str\\**padTrailing**(*string|null* **string**, *positive-int* **length**, *string* **char**): *string|null*
    *Pads the given string to the specified length with the given character.*
- **replace**
    \\rkr\\str\\**replace**(*string|null* **haystack**, *string|null* **needle**, *string|null* **replacement**): *string|null*
    *Replace all occurrences of the needle in the haystack with the replacement.*
- **replaceFirst**
    \\rkr\\str\\**replaceFirst**(*string|null* **haystack**, *string|null* **needle**, *string|null* **replacement**): *string|null*
    *Replace the first occurrence of a needle in the haystack with a replacement.*
- **replaceLast**
    \\rkr\\str\\**replaceLast**(*string|null* **haystack**, *string|null* **needle**, *string|null* **replacement**): *string|null*
    *Replaces all occurrences of a string in another string.*
- **replacePrefix**
    \\rkr\\str\\**replacePrefix**(*string|null* **string**, *string|null* **prefix**, *string|null* **replacement**): *string|null*
    *Replace the prefix of a string with another string.*
- **replaceSuffix**
    \\rkr\\str\\**replaceSuffix**(*string|null* **string**, *string|null* **suffix**, *string|null* **replacement**): *string|null*
    *Replaces the suffix of a string.*
- **reverse**
    \\rkr\\str\\**reverse**(*string|null* **string**): *string|null*
    *Reverse a given string.*
- **shift**
    \\rkr\\str\\**shift**(*string|null* **string**, *positive-int* **length**): *null|array{: string, : string}*
    *Shifts a string by a given length.*
- **startsWith**
    \\rkr\\str\\**startsWith**(*string|null* **haystack**, *string|null* **needle**): *bool*
    *Checks if the haystack starts with the needle.*
- **substr**
    \\rkr\\str\\**substr**(*string|null* **string**, *int* **start**, *int|null* **length**): *string|null*
    *Get a substring of a string.*
- **trim**
    \\rkr\\str\\**trim**(*string|null* **string**, *string|null* **chars** *null*): *string|null*
    *Trims the given string by removing the specified characters from the beginning and the end.*
- **trimLeft**
    \\rkr\\str\\**trimLeft**(*string|null* **string**, *string|null* **chars** *null*): *string|null*
    *Trims the specified characters from the beginning of the string.*
- **trimRight**
    \\rkr\\str\\**trimRight**(*string|null* **string**, *string|null* **chars** *null*): *string|null*
    *Trims the specified characters from the end of the string.*
- **upper**
    \\rkr\\str\\**upper**(*string|null* **string**): *string|null*
    *Convert a string to uppercase.*

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

4441d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rkr-strings/health.svg)

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

###  Alternatives

[bluebaytravel/dosh

Simple currency formatter for PHP.

2120.8k](/packages/bluebaytravel-dosh)

PHPackages © 2026

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