A powerful and flexible PHP library for formatting and transforming strings.
composer require respect/string-formatterYou can use individual formatters directly or chain multiple formatters together using the FormatterBuilder:
use Respect\StringFormatter\FormatterBuilder as f;
echo f::create()
->mask('7-12')
->pattern('#### #### #### ####')
->format('1234123412341234');
// Output: 1234 12** **** 1234| Formatter | Description |
|---|---|
| MaskFormatter | Range-based string masking with Unicode support |
| PatternFormatter | Pattern-based string filtering with placeholders |
| PlaceholderFormatter | Template interpolation with placeholder replacement |
Please see our Contributing Guide for information on how to contribute to this project.
This project is licensed under the ISC License - see the LICENSE file for details.