bacon / bacon-string-utils
BaconStringUtils contain utitilies to work with strings.
Installs: 636 917
Dependents: 4
Suggesters: 0
Security: 0
Stars: 27
Watchers: 9
Forks: 5
Open Issues: 0
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: ~3.7
- satooshi/php-coveralls: ~0.6
- squizlabs/php_codesniffer: ~1.5
- zendframework/zendframework: ~2.0
Suggests
- zendframework/zend-filter: To use the Slugifier as a Zend\Filter instance.
This package is auto-updated.
Last update: 2024-11-16 04:32:48 UTC
README
Introduction
BaconStringUtils contain utitilies to work with strings. The currently included components are:
-
BaconStringUtils\Slugifier URI-friendly slug generator.
You sometimes need to display a text value in a URI, like for instance the title of an article in a blog URL, like those generated by wordpress. This component helps you to generate such a usable slug. It interally makes use of the BaconStringUtils\UniDecoder component also provided by this library.
-
BaconStringUtils\UniDecoder US-ASCII transliterations of Unicode text.
It often happens that you have non-Roman text data in Unicode, but you can't display it -- usually because you're trying to show it to a user via an application that doesn't support Unicode, or because the fonts you need aren't accessible. You could represent the Unicode characters as "???????" or " BA A0q0...", but that's nearly useless to the user who actually wants to read what the text says.
What this component provides is a method, 'decode(...)' that takes Unicode data and tries to represent it in ASCII characters (i.e., the universally displayable characters between 0x00 and 0x7F). The representation is almost always an attempt at transliteration -- i.e., conveying, in Roman letters, the pronunciation expressed by the text in some other writing system.
For example "$decoder->decode('北亰')" returns "Bei Jing".
This is a PHP port of the UniDecode Python module, which on the other hand is a port of the Text::Unidecode Perl module by Sean M. Burke sburke@cpan.org.