spatie/string
Fluent string wrapper for PHP. Wrap a value with string() and chain helpers like between(), toUpper()/toLower(), etc. Supports offset access and mutation via array syntax. Great for readable, composable string transformations.
Feature Development:
Str::of($string)->slug(), Str::of($string)->title()).Roadmap Prioritization:
preg_replace() or str_replace() chains with optimized methods (e.g., Str::of($string)->ascii()).Use Cases:
Str::of("Hello World!")->slug() → hello-world).Str::of($userInput)->trim()->toLowerCase()).Str::of("Café")->ascii() → Cafe).Str::of($description)->limit(100)).Adopt When:
Str::of()->slug()->lower()).StringHelper class).Look Elsewhere If:
symfony/string or league/uri for newer features).php-ai/php-ai instead).For Executives:
"This package cuts development time for string-heavy features—like slug generation or input sanitization—by 30–50% using a lightweight, open-source utility. For example, generating SEO-friendly URLs from titles ('Hello World!' → 'hello-world') becomes a one-liner instead of debugging regex. It’s MIT-licensed, Laravel-friendly, and maintained by a trusted agency (Spatie), reducing risk while improving code consistency across our stack."
For Engineers:
*"Spatie’s string package provides a fluent, expressive API for common string operations (e.g., Str::of($text)->slug()->limit(50)). It’s a drop-in replacement for manual str_replace() chains, with methods for:
slug()title(), snake(), kebab()ascii(), trim()locale() (basic support)
It’s lightweight (~1KB), zero-dependency, and integrates with Laravel’s service container. Perfect for APIs, CMS features, or user input validation where string logic is repetitive."*How can I help you explore Laravel packages today?