Soon, Laravel 9 wil release and there are some new features that we can use them.
This series is going to be a sequel about Laravel framework version 9 and in each article we will review a new feature!
A new useful helper in Laravel 9 is
str(). This function will return a new
Illuminate\Support\Stringable). We had this method on
Str class and now it is more easier to use. eg:
$name = str('Reza')->append(' Khademi'); // 'Reza Khademi' $snake = str()->snake('LaravelFramework'); // 'laravel_framework
We should know, if no argument passed to this function it will give us a new instance of
If we want to redirect user to a specific route, this will come handy:
return to_route( 'users.show', ['user' => 1], 302, ['X-Framework' => 'Laravel'] );
we can pass the route name as the first, our desired data as the second and additional response headers as the third and fourth arguments to the
Since PHP 8,
str_ends_with() functions moved in to the