PHPackages                             hugsbrugs/php-string - 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. hugsbrugs/php-string

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

hugsbrugs/php-string
====================

PHP String Utilities

1.2(4y ago)0153.8k↓11%3PHP

Since Mar 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hugsbrugs/php-string)[ Packagist](https://packagist.org/packages/hugsbrugs/php-string)[ RSS](/packages/hugsbrugs-php-string/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (5)Used By (3)

php-string
----------

[](#php-string)

This librairy provides utilities function to ease string manipulation

[![Build Status](https://camo.githubusercontent.com/fbc9b7d326f4c05b24e73151caaa4392a2b998d2d7206088ef28d0d5011511d5/68747470733a2f2f7472617669732d63692e6f72672f6875677362727567732f7068702d737472696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hugsbrugs/php-string)[![Coverage Status](https://camo.githubusercontent.com/04812e14dfdec7594c750f790a5ff33f7ef14ca3a4b9156dfa7cd24d39db6942/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6875677362727567732f7068702d737472696e672f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/hugsbrugs/php-string?branch=master)

Install
-------

[](#install)

Install package with composer

```
composer require hugsbrugs/php-string

```

In your PHP code, load library

```
require_once __DIR__ . '/../vendor/autoload.php';
use Hug\HString\HString as HString;
```

Note: I couldn't use String as namespace because it's a PHP reserved word so it's why namespace is HString ...

Usage
-----

[](#usage)

Replace the last occurrence of a string

```
$string = HString::str_replace_last($search, $replace, $subject);
```

Checks whether a string starts with given chars

```
$bool = HString::starts_with($haystack, $needle);
```

Checks whether a string ends with given chars

```
$bool = HString::ends_with($haystack, $needle);
```

Checks whether a string contains utf8mb4 chars (Chars coded on 4 bytes)

```
$bool = HString::is_utf8mb4($search);
```

Unit Tests
----------

[](#unit-tests)

```
phpunit --bootstrap vendor/autoload.php tests

```

Author
------

[](#author)

Hugo Maugey [visit my website ;)](https://hugo.maugey.fr)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

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

Total

4

Last Release

1505d ago

Major Versions

0.1 → 1.02017-03-15

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpstring

### Embed Badge

![Health badge](/badges/hugsbrugs-php-string/health.svg)

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

###  Alternatives

[hoanganh25991/php-read-ipa

Read basic info about an application from .ipa file.

111.5k](/packages/hoanganh25991-php-read-ipa)

PHPackages © 2026

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