Sign in

What’s New Features in Laravel 9? — 10 Reasons to Upgrade your Existing Project to Laravel 9

Kane Jason
What’s New Features in Laravel 9? — 10 Reasons to Upgrade your Existing Project to Laravel 9

Greetings to everyone,

Today I will go through how to upgrade your Laravel application to version 9, Laravel 9 was released on 8th Feb 2022. It includes many new features, but one thing that is different is that the latest release only goes with the minimal version of PHP 8.0!

Yes, it definitely means that if your Laravel application is in Laravel 8 or older, you may need to upgrade your PHP version before upgrading the application.

What's New In Laravel 9 Release?

  • Minimum PHP version of 8.0. requirement
  • Shift from swift mailer to symfony mailer
  • Upgrade of the file system to file system 3. x
  • Improved Eloquent Accessors / Mutators
  • Enum Eloquent Attribute Casting
  • Implicit Route Bindings With Enums
  • Forced Scoping Of Route Bindings
  • Controller Route Groups
  • Laravel Scout Database Engine
  • Rendering Inline Blade Templates
  • Slot Name Shortcut
  • Checked / Selected Blade Directives
  • Bootstrap 5 Pagination Views ( Paginator::useBootstrapFive(); )
  • Improved Validation Of Nested Array Data
  • Laravel Breeze API & Next.js
  • Improved Ignition Exception Page
  • Improved route: list CLI Output
  • Test Coverage Using Artisan test Command
  • Socket Echo Server
  • New Helpers

How to Update Laravel? — 10 Reasons to Upgrade From Laravel 8 to 9

Let’s look for what is new in Laravel 9, which makes it a reason to upgrade from Laravel 8.

1) Symfony Mailer

This is one of the largest changes made in Laravel’s latest version. SwiftMailer hasn’t been updated after November 2021 and isn’t available after December 2021. Now, this is already a big reason to upgrade to Laravel 9!

Symfony Mailer replaces SwiftMailer as the internal mail library. This will provide more consistency to your application.

To obtain full compatibility of your application, check for the following changes:

  • Requirement of symfony/mailgun-mailer and symfony/http-client composer packages.
  • Switching of wildbit/swiftmailer-postmark with symfony/postmark-mailer and symfony/http-client
  • Access Symfony\Component\Mailer\SentMessage via getSymfonySentMessage
  • Different undocumented SwiftMailer documents are renamed to their Symfony Mailer counterparts.
  • Symfony Mailer will automatically create Message-ID based on the sender instead of using mime.idgenerator.idright configuration option.
  • Transport reconnections will not be forced. Symfony Mailer will automatically attempt to reconnect.
  • Symfony Mailer will require you to define the appropriate options directly within the configuration if they are supported.
  • Codes relying on missing methods proxied to SwiftMailer in the Laravel version 8 should now be updated with their corresponding Symfony Mailer counterparts.

2) Flysystem 3.x

The Laravel latest version 9.x, has migrated from Flysystem 1.x to 3.x powers file manipulation methods. The updated Laravel version will make the Laravel development process seamless. Take a look at the application changes mentioned below:

  • Write operations will now automatically overwrite the existing files.
  •  If the write operation fails, it will no longer throw an exception.
  • As cached adapters are no longer supported, the cache key within the disk configuration could be removed.

3) Improved Accessors/ Mutators

In Laravel 9 you can now use Illuminate\Database\Eloquent\Casts\Attribute to define accessors and mutators.

This is a single and non-prefixed method to declare a model prefix.

Using this single method, you can now get as well as set the attributes.

In addition, defining accessors will cache object values like in custom cast classes.Laravel 8to 9 Improved Accessors- Mutators

4) Controller Route Groups

The controller method is now used to define a common controller for every route included in the group.

This will make route definition more clear to be readable and easy.Laravel 8 to 9 Controller Route Groups

5) Full-Text Indexes/ Where Clauses

Laravel 9 when using MySQL or PostgreSQL, now includes fulltext method to generate full-text indexes.

Laravel 8 to 9 Full-Text Indexes

The whereFullText method is transformed into the appropriate SQL for the underlying database system by Laravel 9.Full-Text Indexes

Thus, to comprehend why upgrading to Laravel 9 is essential for web app development and explore detailed features of Laravel 9, read our latest blog post here — https://bit.ly/3zkVqF3 

Want to update your existing project from Laravel 8 to 9? Here is a complete guide, click here — https://bit.ly/3zkVqF3 

Kane Jason
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more