Before https://laravel.com/docs/9.x/releases, when you wanted to interact with strings you would either use the Illuminate\Support\Str class like so. use Illuminate\Support\Str; $result = Str::endsWith('PHP is awesome', 'PHP'); // Outputs: true Or if you want to do these string operations fluently, you can use the Illuminate\Support\Str::of that returns the instance of Illuminate\Support\Stringable class like so.
Laravel 9 now comes with a new str() helper function globally that you can use to do string operations fluently just like how you would do with Str::of.
As you can tell, the one advantage this helper method brings is now you don’t have to import the Illuminate\Support\Str class altogether.