cline / babel
Unicode-aware string encoding, conversion, and analysis library for PHP
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/cline/babel
Requires
- php: ^8.2
- ext-iconv: *
- ext-intl: *
- ext-mbstring: *
Requires (Dev)
- cline/coding-standard: ^1.5.6
- orchestra/testbench: ^10.8
- symfony/var-dumper: ^7.4.0
README
Unicode-aware string encoding, conversion, and analysis for PHP with a fluent API. Features script detection, directionality analysis, character analysis, and intelligent transliteration.
Requirements
Requires PHP 8.2+ with
ext-intl,ext-mbstring, andext-iconv
Installation
composer require cline/babel
Documentation
- Getting Started - Installation and basic usage
- Conversion - Encoding conversion methods
- Script Detection - Detect scripts and character sets
- Directionality - RTL/LTR detection
- Character Analysis - Analyze string contents
- Normalization - Clean and normalize strings
Quick Examples
use Cline\Babel\Babel; // Convert to ASCII with transliteration Babel::from('Żółć')->toAscii(); // "Zolc" Babel::from('北京')->toAscii(); // "bei jing" Babel::from('Привет')->toAscii(); // "Privet" // Detect scripts Babel::from('Hello 世界')->containsChinese(); // true Babel::from('Привет мир')->containsCyrillic(); // true Babel::from('مرحبا')->isRtl(); // true // Clean strings Babel::from("Hello\x00World")->removeNonPrintable()->value(); // "HelloWorld" Babel::from('Hello 👋')->removeEmoji()->value(); // "Hello " // Create slugs Babel::from('Héllo Wörld!')->toSlug(); // "hello-world"
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.
Credits
License
The MIT License. Please see License File for more information.