respect/string-formatter
Flexible PHP string formatting library with chainable formatters and templated placeholders. Mask, pattern, date, number, and more to transform/format values (e.g., credit cards, phones, amounts) via FormatterBuilder or PlaceholderFormatter modifiers.
MetricFormatter for EU, ImperialFormatter for US).SecureCreditCardFormatter for forms).PlaceholderFormatter for dynamic templates).PatternFormatter for phone numbers).PlaceholderFormatter for emails/invoices.Symfony String.Symfony String or Egulias/EmailValidator.str_replace).Twig or Laravel Blade directives.Spomky-Labs/Base64Url.Executives: *"This package standardizes string formatting across our apps—reducing bugs in user-facing outputs (e.g., payments, localization) while supporting global compliance. For example:
MaskFormatter for SSNs).Engineering: *"Respect/StringFormatter replaces spaghetti string manipulation with a composable, Unicode-safe API. Key wins:
trim()->mask()->uppercase()) via FormatterBuilder.TrimFormatter with custom chars).PatternFormatter), but docs/templates accelerate adoption. Laravel Integration: Bind to the service container or use as a facade (e.g., StringFormatter::mask())."*DevOps:
"Lightweight (~1MB), PHP 8.1+ compatible, and CI-ready (GitHub Actions). No external dependencies—just composer require respect/string-formatter. Performance: Benchmark critical paths (e.g., bulk processing) and cache results if needed. Security: Validate user-provided patterns (e.g., PatternFormatter) to prevent ReDoS."
Product/Design: *"Enables consistent UX across apps (e.g., phone numbers, dates) without manual styling. Example:
****-****-****-1234 in UI but store securely.1,234.56 in US and 1.234,56 in EU automatically.PlaceholderFormatter for dynamic emails/invoices (e.g., {{name|uppercase}})."*How can I help you explore Laravel packages today?