https://github.com/mathiasreker/php-mbstring-extension
The php-mbstring-extension is a PHP library that provides support for multibyte strings that are not covered by the standard PHP string functions.
https://github.com/mathiasreker/php-mbstring-extension
php-library
Last synced: 10 months ago
JSON representation
The php-mbstring-extension is a PHP library that provides support for multibyte strings that are not covered by the standard PHP string functions.
- Host: GitHub
- URL: https://github.com/mathiasreker/php-mbstring-extension
- Owner: MathiasReker
- License: mit
- Created: 2023-03-24T21:54:34.000Z (over 3 years ago)
- Default Branch: develop
- Last Pushed: 2025-05-08T04:03:19.000Z (about 1 year ago)
- Last Synced: 2025-07-30T20:40:48.083Z (11 months ago)
- Topics: php-library
- Language: PHP
- Homepage: https://github.com/MathiasReker/php-mbstring-extension
- Size: 27.3 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
PHP Multibyte String Extension
[](https://packagist.org/packages/MathiasReker/php-mbstring-extension)
[](https://packagist.org/packages/MathiasReker/php-mbstring-extension)
[](https://github.com/MathiasReker/php-mbstring-extension/actions/workflows/ci.yml)
[](https://github.com/MathiasReker/php-mbstring-extension/graphs/contributors)
[](https://github.com/MathiasReker/php-mbstring-extension/network/members)
[](https://github.com/MathiasReker/php-mbstring-extension/stargazers)
[](https://github.com/MathiasReker/php-mbstring-extension/issues)
[](https://github.com/MathiasReker/php-mbstring-extension/blob/develop/LICENSE.txt)
The `php-mbstring-extension` is a PHP library that provides support
for [multibyte strings](https://www.php.net/manual/en/ref.mbstring.php) that are not covered by the standard PHP string
functions.
### Versions & Dependencies
| Version | PHP | Documentation |
|---------|------|---------------|
| ^2.0 | ^8.0 | current |
### Requirements
- `PHP` >= 8.0
- php-extension `ext-mbstring`
### Installation
To acquire the package, utilize the composer package manager.
```bash
composer require mathiasreker/php-mbstring-extension
```
### Documentation
## ✅ levenshtein
Calculate the Levenshtein distance between two strings.
```php
\MathiasReker\PhpMbFunctions\Mbstring::levenshtein(
string $s1,
string $s2,
int $cost_ins = 1,
int $cost_rep = 1,
int $cost_del = 1
): int
```
## ✅ ucwords
Uppercase the first character of each word in a string.
```php
\MathiasReker\PhpMbFunctions\Mbstring::ucwords(
string $string,
string $separators = " \t\r\n\f\v",
string $encoding = 'UTF-8'
): string
```
## ✅ ucfirst
Make the first character of a string uppercase.
```php
\MathiasReker\PhpMbFunctions\Mbstring::ucfirst(
string $string,
string $encoding = 'UTF-8'
): string
```
## ✅ strrev
Reverse a string.
```php
\MathiasReker\PhpMbFunctions\Mbstring::strrev(
string $string,
string $encoding = 'UTF-8'
): string
```
## ✅ count_chars
Returns information about characters used in a string.
```php
\MathiasReker\PhpMbFunctions\Mbstring::count_chars(
string $string,
int $mode,
string $encoding = 'UTF-8'
): array|string
```
## ✅ trim
Multibyte-aware trim function.
```php
\MathiasReker\PhpMbFunctions\Mbstring::trim(
string $str,
string $charlist = " \t\n\r\0\x0B"
): string
```
### Roadmap
See the [open issues](https://github.com/MathiasReker/php-mbstring-extension/issues) for a complete list of proposed
features (and known issues).
### Contributing
If you have a suggestion to enhance this project, kindly fork the repository and create a pull request. Alternatively,
you may open an issue and tag it as "enhancement". Lastly, do not hesitate to give the project a star ⭐. Thank you for
your support.
#### Docker
If you are utilizing Docker, the following command can be used to initiate the process:
```bash
docker-compose up -d
```
Next, access the container:
```bash
docker exec -it php-mbstring-extension bash
```
#### Tools
PHP Coding Standards Fixer:
```bash
composer cs-fix
```
PHP Coding Standards Checker:
```bash
composer cs-check
```
Rector Fixer:
```bash
composer rector-fix
```
Rector Checker:
```bash
composer rector-check
```
PHP Stan:
```bash
composer phpstan
```
Unit tests:
```bash
composer test
```
### License
The distribution of the package operates under the `MIT License`. Further information can be found in the LICENSE file.