What’s New in Laravel 10: New Features of Laravel 10
In this post we will give you information about What’s New in Laravel 10: New Features of Laravel 10. Hear we will give you detail about What’s New in Laravel 10: New Features of Laravel 10 And how to use it also give you demo for it if it is necessary.
Laravel has been one of the most popular PHP frameworks for many years. It’s elegant, scalable, has become one of the de facto frameworks for developers and companies working with PHP. Now, Laravel 10 is on the way with a ton of new features.
In the past, new releases have been happening every six months, resulting in a fair amount of questions, harsh comments, and confusion about Laravel’s new release process. With the release of Laravel 10, the framework has moved to a 12-month major release cycle and will release in January 2022.
This blog explores Laravel 10’s key features. On top of that, we’ll also detail how to upgrade to Laravel 10 and start developing web apps.
Table of Contents
- What is Laravel?
- Key Features of Laravel
- What To Expect With Laravel 10
- New Features in Laravel 10
- How To Install Laravel 10
What is Laravel?
Laravel is an open-source PHP web application framework with expressive, elegant syntax. It is an MVC framework for building simple to complex web applications using the PHP programming language.
Laravel strictly follows the MVC (Model-View-Controller) architectural pattern. It is known for its beautiful and elegant syntax as a web framework.
Key Features of Laravel
Some of the main features of Laravel are:
- Eloquent ORM
- Query builder
- Reverse Routing
- Restful Controllers
- Migrations
- Database Seeding
- Unit Testing
- Homestead
- Source code hosted on GitHub and licensed under MIT License.
- Most Starred PHP Framework for custom software development on Github.
- Its ability to use all of the new features of PHP sets it apart.
- Friendly online community
- Detailed documentation
- Security
What To Expect With Laravel 10
Laravel 10 is the first Long Term Support (LTS) released in a 12-month release cycle and was initially scheduled to be released by September 2021; however. The Laravel team decided to push it to January 2022.
This release schedule is due to these reasons outlined below: with these reasons below, the release date was pushed forward.
- Laravel as a framework relies on different community-driven and 9 Symfony libraries, and Symfony is planning to release v6.0 by November 2021, making the Laravel team delay the release of Laravel v9.
- To update or upgrade the entire Laravel framework to the latest version of Symfony will take a while and also lots of testing and monitoring against any breaking changes before releasing it to the public.
- Finally, delaying the release of Laravel 10 till January 2022 will better position the Laravel team to release subsequent LTS yearly which gives the Laravel team 2 months after Symfony’s releases.
Now that we know the reasons for the changes, let’s explore the new Laravel v9 before it is released by January 2022.
Also see: Build a Basic CRUD App with Laravel 10 and React.js
New Features in Laravel 10
Below is the newest features and improvement that we should expect in the Laravel v9 by January 2022:
Minimum PHP Requirement
Since Laravel 10 will require Symfony 6.0 and it has a minimum requirement of PHP 8 that means Laravel 10 will carry this same restriction.
New Design for routes:list
The routes:list
the command has been included in Laravel for a long time now, and one issue that sometimes arises is if you have huge and complex routes defined it can get messy trying to view them in the console.
Anonymous stub migration
With Laravel 10, you can set anonymous stub migration as the default behavior while running the popular migration command. This valuable feature came out with the release of Laravel 10.37, which aimed to solve the GITHUB issue.
What is this issue? When you create a database from scratch, numerous migrations with the same class name can create problems. With the anonymous stub migration feature, issues related to class name collisions are eradicated instantly.
Since the release of Laravel 10.37, the frameworks support anonymous class migration files. With Laravel 10, the same would become the default behavior when Laravel 10 will be launched and when you execute php artisan make:migration
.
<?php
use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table)
{
$table->string('first_name')->nullable();
});
}
};
New Query Builder Interface
Appreciations to Chris Morrell, Laravel 10 will highlight a new Query Builder Interface, and you can view this merged PR for all the details.
For developers who depend on sort insights for static analysis, refactoring, or code completion in their IDE, the need for a shared interface or legacy between QueryBuilder, EloquentBuilder, and EloquentRelation can be much complex.
return Model::query()
->whereNotExists(function($query) {
// $query is a QueryBuilder
})
->whereHas('relation', function($query) {
// $query is an EloquentBuilder
})
->with('relation', function($query) {
// $query is an EloquentRelation
});
This version added the new IlluminateContractsDatabaseQueryBuilder interface
, as well as the IlluminateDatabaseEloquentConcernsDecoratesQueryBuilder
a trait that will implement the interface in place of the __call
magic method.
PHP 8 String Functions
Since PHP 8 will be the least, Tom Schlick acknowledged a PR to move to using str_contains(), str_starts_with() and str_ends_with() functions internally in the IlluminateSupportStr class.
Laravel 10’s features and improvements listed above are a sneak peek at what is to come. It’ll most definitely bring lots of bug fixes, features, and, of course, many breaking changes.
From Swift Mailer to Symfony Mailer
Symfony deprecated Swift Mailer and Laravel 10 makes the change to use Symfony Mailer for mail transport. There are a few breaking changes as a result, you can see the PR for more information.
How To Install Laravel 10
For development and testing purposes, you can easily install and run Laravel 10 on your local device. As stated above, Laravel supports PHP v8 engine only. Check your current PHP version before installation and testing. To simplify matters, get rid of the existing version and begin a fresh install.
With the command mentioned above, you can create a new Laravel project while naming it laravel-10-dev, using the latest Laravel 10 which is still under development. To install, run:
composer create-project --prefer-dist laravel/laravel laravel-10-dev test-laravel10
or, if you have installed the Laravel Installer as a global composer dependency:
laravel new laravel-10-dev test-laravel10
After you finish installing Laravel 10, enter the new directory, and run the artisan command to check the current version.
cd dev-laravel10
php artisan --version
Thank you for reading this blog.
Conclusion
This blog detailed the features of Laravel 10 and what to expect in future releases. It also explored how to update or upgrade to Laravel 10 and install and start building an app with the new Laravel 10.
Also see: Top Laravel Interview Questions & Answers 2022
. .
Hope this code and post will helped you for implement What’s New in Laravel 10: New Features of Laravel 10. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs