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.

2.0.0 2024-04-23 17:33 UTC

This package is auto-updated.

Last update: 2024-10-23 18:47:36 UTC


README

Packagist Version Packagist Downloads CI status Contributors Forks Stargazers Issues MIT License

The php-mbstring-extension is a PHP library that provides support for multibyte strings that are not covered by the standard PHP string functions.

Versions & Dependencies

Requirements

  • PHP >= 8.0
  • php-extension ext-mbstring

Installation

To acquire the package, utilize the composer package manager.

composer require mathiasreker/php-mbstring-extension

Documentation

✅ levenshtein

Calculate the Levenshtein distance between two strings.

\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.

\MathiasReker\PhpMbFunctions\Mbstring::ucwords(
    string $string,
    string $encoding = 'UTF-8'
): string

✅ ucfirst

Make the first character of a string uppercase.

\MathiasReker\PhpMbFunctions\Mbstring::ucfirst(
    string $string,
    string $encoding = 'UTF-8'
): string

✅ strrev

Reverse a string.

\MathiasReker\PhpMbFunctions\Mbstring::strrev(
    string $string,
    string $encoding = 'UTF-8'
): string

✅ count_chars

Returns information about characters used in a string.

\MathiasReker\PhpMbFunctions\Mbstring::count_chars(
    string $string,
    int $mode,
    string $encoding = 'UTF-8'
): array|string

✅ trim

Multibyte-aware trim function.

\MathiasReker\PhpMbFunctions\Mbstring::trim(
    string $str,
    string $charlist = " \t\n\r\0\x0B"
): string

Roadmap

See the open 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:

docker-compose up -d

Next, access the container:

docker exec -it php-mbstring-extension bash

Tools

PHP Coding Standards Fixer:

composer cs-fix

PHP Coding Standards Checker:

composer cs-check

Rector Fixer:

composer rector-fix

Rector Checker:

composer rector-check

PHP Stan:

composer phpstan

Unit tests:

composer test

License

The distribution of the package operates under the MIT License. Further information can be found in the LICENSE file.