Laravel 9 is released with many new advanced features And Laravel new major versions are released every 12 months instead of six months earlier.
Laravel 9 requirements1) PHP 8.0
Laravel 9 requires a minimum PHP version of 8.0
Laravel 9 Features
1) Group the methods of controllers in routes
Now we can group the routes of the same controller, When we define the routes, we need to provide the Controller method as below.
use App\Http\Controllers\OrderController;
Route::controller(OrderController::class)->group(function () {
Route::get('/orders/{id}', 'show');
Route::post('/orders', 'store');
});
2) Full-text index or where clause
Now we can filter the data if all the characters of the string matched with a database index value
Example :
$users = DB::table('users')
->whereFullText('bio', 'webdeveloper')
->get();
3) Checked or selected Flags for blades
now use the @checked directive to easily indicate if a given HTML checkbox input is "checked".
<input type="checkbox" name="active" value="active" @checked(old('active', $user->active)) />
Same for selected value in select tag<select name="version">
@foreach ($product->versions as $version)
<option value="{{ $version }}" @selected(old('version') == $version)>
{{ $version }}
</option>
@endforeach
</select>
4) Bootstrap 5 pagination for views
Now we can include pagination views built using Bootstrap 5. To use these views you may call the paginator's useBootstrapFive method within the boot method of your App\Providers\AppServiceProvider class
use Illuminate\Pagination\Paginator;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Paginator::useBootstrapFive();
}
5) New design for route:list CLI output
route:list CLI output screen is improved in Laravel 9.x
6) Error exception page is redesigned
Laravel 9 got new error exception page with Light and dark them and open in editor option
For more details click here