PHPackages                             polyfills/mb-trim - 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. polyfills/mb-trim

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

polyfills/mb-trim
=================

PHP: Provides a user-land polyfill for `mb\_trim`, `mb\_ltrim`, and `mb\_rtrim` functions added in PHP 8.4.

v0.1.2(2y ago)55.3k↓40.3%1[1 issues](https://github.com/PHP-Polyfills/mb_trim/issues)[1 PRs](https://github.com/PHP-Polyfills/mb_trim/pulls)MITPHPPHP ^8.1

Since Jan 10Pushed 2y ago2 watchersCompare

[ Source](https://github.com/PHP-Polyfills/mb_trim)[ Packagist](https://packagist.org/packages/polyfills/mb-trim)[ RSS](/packages/polyfills-mb-trim/feed)WikiDiscussions main Synced 2d ago

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

`mb_trim`, `mb_ltrim`, and `mb_rtrim` polyfills
===============================================

[](#mb_trim-mb_ltrim-and-mb_rtrim-polyfills)

[![Latest Stable Version](https://camo.githubusercontent.com/2aac3b48f9318fb13bcfd0ab89e84fa6a69675cf185087e346e643fbe083a72c/68747470733a2f2f706f7365722e707567782e6f72672f706f6c7966696c6c732f6d622d7472696d2f76)](https://packagist.org/packages/polyfills/mb-trim) [![License](https://camo.githubusercontent.com/296ed0fa7fd8274fc7b46d3c674b4612c29d1eb2cec96c1a821efdc1e9e4123c/68747470733a2f2f706f7365722e707567782e6f72672f706f6c7966696c6c732f6d622d7472696d2f6c6963656e7365)](https://packagist.org/packages/polyfills/mb-trim) [![PHP Version Require](https://camo.githubusercontent.com/2ad99bb46640b55a2dcc79422c9184d3af8af0ecdf13086156f0fb575ede8e23/68747470733a2f2f706f7365722e707567782e6f72672f706f6c7966696c6c732f6d622d7472696d2f726571756972652f706870)](https://packagist.org/packages/polyfills/mb-trim)

Provides user-land PHP polyfills for the [`mb_trim`, `mb_ltrim`, and `mb_rtrim` functions added in PHP 8.4](https://php.watch/versions/8.4/mb_trim-mb_ltrim-mb_rtrim).

Requires PHP 8,1, 8.2 or PHP 8.3 with `mbstring` extension. Not supported on PHP 8.4 because these functions are natively implemented in PHP 8.4.

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

[](#installation)

```
composer require polyfills/mb-trim
```

Usage
-----

[](#usage)

Simply use the `mb_trim`, `mb_ltrim`, and `mb_rtrim` functions as if they were declared already.

Contributions
-------------

[](#contributions)

Contributions are welcome either as a GitHub issue or a PR to this repo.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.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 ~0 days

Total

3

Last Release

905d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/811553?v=4)[Ayesh Karunaratne](/maintainers/Ayesh)[@Ayesh](https://github.com/Ayesh)

---

Top Contributors

[![Ayesh](https://avatars.githubusercontent.com/u/811553?v=4)](https://github.com/Ayesh "Ayesh (18 commits)")[![fisharebest](https://avatars.githubusercontent.com/u/2306088?v=4)](https://github.com/fisharebest "fisharebest (1 commits)")

---

Tags

compatmbstringphpphp8php84polyfills

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/polyfills-mb-trim/health.svg)

```
[![Health](https://phpackages.com/badges/polyfills-mb-trim/health.svg)](https://phpackages.com/packages/polyfills-mb-trim)
```

###  Alternatives

[bhaktaraz/php-rss-generator

Simple RSS generator library for PHP 5.5 or later.

62134.2k1](/packages/bhaktaraz-php-rss-generator)

PHPackages © 2026

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