Today, In this tutorial, i would like to talk about Laravel new version Laravel 10. I will show how to install laravel 10 in your system and what is new features in laravel 10.
Day by day laravel improves secure, modern, and scalable applications. Also, it creates powerful and reusable codes and functionalities in the laravel framework.
Taylor Otwell going to release new version of laravel call “Laravel 10”. Here, i will show you step by step install laravel 10, laravel 10 new features and updates. so let’s see.
When Laravel 10 will be Released?
Still not final decide but according to Support Policy docs. They says “Q1 2023”. So may be in February, 2023.
How to Install Laravel 10?
If you are using laravel installer then you can install laravel 10 using following command:
laravel new example-app --dev
Or, if you prefer to explicitly use Composer.
composer create-project --prefer-dist laravel/laravel example-app dev-master
Laravel 10: New Features and Changes
Here, i will show you one by one new updates about laravel 10.
1) Drop PHP 8.0 Support in Laravel 10
In the laravel 10, PHP8.0 is dropped. It supports the latest version of PHP 8.1 and PHP 8.2.
See the pull request on GitHub: [10.x] Drop PHP 8.0
2) Language Directory Command in Laravel 10
Before, laravel provides by default lang directory for multiple language management. But in laravel 10 you need to generate lang directory by using following command:
php artisan lang:publish
3) Drop The Redirect::home Method in Laravel 10
In Laravel 10, They drop Redirect::home method from route file. now if you want to create home route then you have to use named routed and use like the below:
return Redirect::route('home');
4) Drop Bus::dispatchNow Method in Laravel 10
In Laravel 10, They drop Bus::dispatchNow and dispatch_now methods. You should use Bus::dispatchSync and dispatch_sync methods.
5) Make Invokable Rules Default in Laravel 10
In Laravel 10, now you can create by default invokable rules using invokable flag with command. you can create using following command:
php artisan make:rule Uppercase --invokable
See the pull request on GitHub: [10.x] Make invokable rules default
6) PHP Native Type Declaration in Laravel 10
In laravel 10, Many functions declaration is changed and it can use PHP native type declaration.
Let’s see an example.
/**
* Handle the User "created" event.
- *
- * @param \App\Models\User $user
- * @return void
*/
- public function created($user)
+ public function created(User $user): void
Read Also: Laravel 10 REST API with Passport Authentication Tutorial
**
* Define the application's command schedule.
*
- * @param \Illuminate\Console\Scheduling\Schedule $schedule
- * @return void
*/
- protected function schedule($schedule)
+ protected function schedule(Schedule $schedule): void
See the pull request on GitHub: [10.x] Uses PHP Native Type Declarations
I hope it can help you…