DEV Community

Morcos Gad
Morcos Gad

Posted on

New Things Added - Laravel 9.15 Released

Let's get started quickly I found new things in Laravel 9.15 Released I wanted to share with you.

  • Only vendors listed in route:list command

--only-vendor flag to the route:list command. Only vendor routes will appear in the terminal, and the command will ignore your application routes

php artisan route:list --only-vendor
Enter fullscreen mode Exit fullscreen mode
  • HTTP client "throw unless" method

throwUnless() function to the Laravel HTTP client. This method will throw an exception if a server or client error occurred and the given condition is false

$response = Http::post(/* ... */);
$response->throwUnless($condition);
Enter fullscreen mode Exit fullscreen mode
  • String isJson() method

isJson() method to the Str and Stringable classes to determine if a string is valid json

Str::isJson($data); //=> boolean

Str::of($data)->isJson() //=> boolean

str($data)->isJson(); //=> boolean
Enter fullscreen mode Exit fullscreen mode
  • Check if a filesystem directory is empty

two methods to determine if a filesystem directory is empty or not

use Illuminate\Support\Facades\File;

if (File::isDirectoryEmpty('john/photos')) {
    return 'You do not have any photos';
}

if (File::isDirectoryNotEmpty('john/videos', true)) {
    return 'You may have one or more videos, even hidden ones.';
}
Enter fullscreen mode Exit fullscreen mode

I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://laravel-news.com/laravel-9-15-0

Top comments (0)