Start a Project

What’s new in Laravel 8.x ?

Introduction

It’s been a while when we last discussed What’s new in Laravel 6. And here we are today discussing about what’s new in Laravel 8.x. Whether you are upgrading to Laravel 8 from Laravel 7 or just getting started from Laravel 8 this blog is going to get very helpful.

We are going to discuss the below mentioned points in this blog.

Laravel JetStream

If you are following Laravel from Previous versions you might be knowing about Laravel UI Scaffolding. Laravel Jetstream is an upgrade on the previously present Laravel UI Scaffolding. The main task of it is to provide a starting point for new projects which includes:

How to use it ?

In order to use Laravel JetStream, you can simply use Laravel Installer to install it.

Models Directory

The old Models Directory is back again. Remember using a separate Models folder for creating Models before Laravel 5. The Models were shifted to app/ directory. Now with Laravel 8.x it shifted back to app/Models.

Model Factory Classes

Eloquent Model Factory are now classes based. It leads to an improvement in support for relationships between factories. (example: multiple posts of a user.).
Let’s check out how is it different from Laravel 7.x

User factory In Laravel 7.x

User factory In Laravel 8.x

You can see the model property and definition method. The definition method then returns the model attributes.

Migration Squashing

If your application contains many migration files, you can now squash them into a single SQL file. This file will be executed first when running migrations, followed by any remaining migration files that are not part of the squashed schema file. Squashing existing migrations can decrease migration file bloat and possibly improve performance while running tests.

Improved Rate Limiting

Laravel 8 brings improvements to existing rate limiting functionality while supporting backward compatibility with the existing throttle middleware and offering far more flexibility. Laravel 8 has the concept of Rate Limiters that you can define via a facade:

The for() method takes the HTTP request instance, giving you full control over limiting requests dynamically.

Time testing helpers

Laravel users have enjoyed full control over time modification via the excellent Carbon PHP library. Laravel 8 brings this one step further by providing convenient test helpers for manipulating the time within tests:

Dynamic Blade Component

Sometimes you need to render a blade component dynamically at runtime. Laravel 8 provides the <x-dynamic-component /> to render the component:

So these all features are introduced with the latest version of Laravel 8.x.

For more information regardin Laravel 8, go to: laravel’s website

Sources:
Laravel’s Website
Laravel News

Exit mobile version