Repolode
symfony

symfony/polyfill-mbstring

A pure-PHP fallback that provides a partial implementation of the Mbstring extension for environments where it is not installed.

Stars
7,815
Forks
39
Open issues
1
Last commit
25 days ago

What is it?

Symfony Polyfill for Mbstring is a PHP library that implements a subset of the multibyte string functions from the Mbstring extension in plain PHP. When the native extension is missing, code that calls functions such as mb_strlen, mb_substr or mb_strtolower can still run without errors.

The package is designed to be installed through Composer as a dependency. It only defines fallback functions when the extension is not loaded, so on servers where Mbstring is available the native implementation is used instead. It is part of the wider Symfony Polyfill collection, which is documented on the main Polyfill page.

The library is released under the MIT license and is only a partial implementation, so it does not cover every function or encoding that the full extension provides.

Key features

  • 01Provides PHP fallbacks for many common mb_* string functions.
  • 02Loads only when the native Mbstring extension is missing.
  • 03Installable via Composer as a regular dependency.
  • 04Part of the Symfony Polyfill collection.
  • 05Released under the MIT license.

Use cases

  • Running PHP applications on hosts where the Mbstring extension cannot be enabled.
  • Keeping code portable across environments with and without Mbstring.
  • Using Symfony components that depend on multibyte string functions.

Things to know

  • It is a partial implementation of the Mbstring extension, not a full replacement.

Topics

FAQ

What is polyfill-mbstring?
A pure-PHP fallback that provides a partial implementation of the Mbstring extension for environments where it is not installed. Symfony Polyfill for Mbstring is a PHP library that implements a subset of the multibyte string functions from the Mbstring extension in plain PHP. When the native extension is missing, code that calls functions such as mb_strlen, mb_substr or mb_strtolower can still run without errors.
Is polyfill-mbstring free to use? What license does it have?
polyfill-mbstring is open source under the MIT license. Check the license terms before using it in commercial products.
Is polyfill-mbstring still maintained?
Actively maintained. The last commit to polyfill-mbstring was on Sep 30, 2026.
What can I use polyfill-mbstring for?
Running PHP applications on hosts where the Mbstring extension cannot be enabled. Keeping code portable across environments with and without Mbstring. Using Symfony components that depend on multibyte string functions.
Where can I get polyfill-mbstring?
The source code and installation instructions are on GitHub: https://github.com/symfony/polyfill-mbstring

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects