twig/string-extra
Twig extension integrating Symfony String: add filters u (UnicodeString methods), slug (AsciiSlugger), and singular/plural (Inflector) to manipulate text, generate slugs, and handle basic inflection directly in Twig templates.
titlecase, snake_case, truncate) across templates, eliminating ad-hoc PHP helpers and reducing bugs. Aligns with Laravel’s "convention over configuration" by providing a native solution for string operations.lower, upper, ascii). Example: Auto-convert titles to lowercase for URLs while preserving original casing in displays.String component.Use when:
Look elsewhere if:
Stringy or Python tools.Str helper or Eloquent is sufficient.For Executives: "This package lets our templating team handle text formatting—like generating SEO slugs, cleaning user input, or localizing content—directly in templates, without backend round-trips. It cuts API calls, speeds up content updates, and aligns with our Laravel/Twig stack. For example, we could auto-generate slugs for blog posts or format dates for international audiences, improving both performance and developer productivity. The MIT license and active maintenance (last release: 2026) make it a low-risk, high-reward choice that reduces technical debt."
For Engineering:
*"Twig/String-Extra adds native Twig/Blade filters for common string tasks (e.g., slugify, truncate, sanitize) that are currently handled inconsistently across the codebase. Benefits:
Str helper and Symfony’s String component.
Tradeoff: Minimal learning curve if your team uses Twig/Blade. Let’s prototype a few use cases (e.g., blog excerpts, form input sanitization) to validate ROI. For Blade users, we’ll need a lightweight wrapper layer (e.g., custom directives)."*For Design/Content Teams:
"This tool will let you control how text appears on the site—like auto-generating clean URLs from titles or formatting headings—without needing to involve developers. For example, you could publish a blog post and instantly get a SEO-friendly URL like /how-to-use-laravel-string-extra. It’s like having a built-in text editor for your templates!"
How can I help you explore Laravel packages today?