Download the PHP package zbateson/mb-wrapper without Composer
On this page you can find all versions of the php package zbateson/mb-wrapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mb-wrapper
zbateson/mb-wrapper
Charset conversion and string manipulation wrapper with a large defined set of aliases.
The goals of this project are to be:
- Well written
- Tested where possible
- Support as wide a range of charset aliases as possible
To include it for use in your project, please install via composer:
Php 7 Support Dropped
As of mb-wrapper 2.0, support for php 7 has been dropped.
Requirements
mb-wrapper requires PHP 8.0 or newer. Tested on PHP 8.0, 8.1, 8.2, and 8.3 on GitHub Actions.
New in 2.0
If converting or performing an operation on a string fails in iconv, an UnsupportedCharsetException is now thrown.
Description
MbWrapper is intended for use wherever mb* or iconv is used. It scans supported charsets returned by mb_listencodings(), and prefers mb functions, but will fallback to iconv if a charset isn't supported by the mb_ functions.
A list of aliased charsets is maintained for both mb* and iconv, where a supported charset exists for an alias. This is useful for mail and http parsing as other systems may report encodings not recognized by mb* or iconv.
Charset lookup is done by removing non-alphanumeric characters as well, so UTF8 will always be matched to UTF-8, etc...
Usage
The following wrapper methods are exposed:
- mb_convert_encoding, iconv with MbWrapper::convert
- mb_substr, iconv_substr with MbWrapper::getSubstr
- mb_strlen, iconv_strlen with MbWrapper::getLength
- mb_check_encoding, iconv (for verification) with MbWrapper::checkEncoding
License
BSD licensed - please see license agreement.
All versions of mb-wrapper with dependencies
symfony/polyfill-mbstring Version ^1.9
symfony/polyfill-iconv Version ^1.9