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.
spatie/string package is a thin abstraction over PHP’s native string handling, making it a low-overhead addition to Laravel applications. It aligns well with Laravel’s composer-based dependency model and service container architecture.Str::of()) or domain services.composer require spatie/string), and it’s ready to use. No migrations, publishers, or complex setup.spatie/laravel-string wrapper).Str helper for custom logic (e.g., advanced slugging, locale-aware transformations).symfony/string or egulias/email-validator).Str helper sufficient?spatie/laravel-string (which registers a String facade)?Str::slug() with String::slug() for custom rules.String::of($text)->ascii()->upper() in form requests or value objects.String::of($name)->title()).Str::, raw preg_replace, or custom functions).spatie/string.Str helper entirely if the package’s API is preferred.String::of("Café")->slug()).spatie/laravel-permission).symfony/string (overlap in functionality).composer require spatie/string
use Spatie\String\String;
$slug = String::of("Hello World")->slug(); // "hello-world"
spatie/laravel-string):
composer require spatie/laravel-string
use String;
$title = String::of("hello")->title(); // "Hello"
Str::slug() with String::of($str)->slug() in controllers, services, or blade templates.spatie/laravel-string) if the original package stagnates.StringException).String::cache()).String::of("Café")->ascii()).null or empty strings gracefully.Str::slug() → String::of()->slug()).How can I help you explore Laravel packages today?