In-Depth Laravel 8 New Released Features | Concetto Labs

In-Depth Laravel 8 New Released Features

Author image By Disha Aghera  |  Tuesday, May 18, 2021 02:01 PM  |  5 min read  |   21

Laravel 8

Laravel 8 is a newly released Laravel framework that launched on 8th September. Peers want to know what’s new in Laravel 8 and what improvement made in Laravel 7. Before understanding the Laravel 8 features, one needs to see the Laravel 6 version. As Laravel 6 framework switches to semantic versioning, we need to understand its process.

Let’s drive-in and take a look at the latest Laravel 8 new features

Laravel 8 New Features

Laravel 8 New Features

1. Laravel Jetstream

One of the best new features in Laravel 8 is Laravel Jetstream. It provides a fantastic starting point for developing Laravel applications development. It uses built-in options like:

  •  Login and Registration
  •  Email Verification
  • Session Management
  • Two Factor authentication
  • Tailwind CSS designed
  • Laravel Sanctum API Support

2. How is Laravel 8 features Jetstream used?

Developers can create a new application with Jetstream by using Laravel installer. One needs to add the following code:
Laravel new your-project –jet

Now choose the stack (Livewire or Inertia). Later run your database migrations like: PHP artisan migrate

Finally, check your app at localhost:8000 by running code: PHP artisan serve

That’s all it’s ready. Get set and explore your new Laravel Jetstream application. One can find the composer installation instructions that available in the Laravel Jetstream documentation.

3. Migration Squashing

Wondering what the best new features in Laravel 8? Well, Laravel 8 introduced another existing new feature migration squashing. With this, we do not need to scroll for longer to open the migration folder. When comparing Laravel 8 vs Laravel 7 migration squashing is one best features of Laravel 8. Using this, one can condense migration files into a single SQL file by using the below code:

PHP artisan schema: dump
PHP artisan schema: dump – prune

Laravel comes with a new schema file database/schema. One needs to use the migration squashing feature to run the schema. Using this feature, Laravel will run the SQL from the schema and then move on to create later in the migration folder.

4. Model Updates

The new features in Laravel 8, i.e. app/Models directory, are back. In the Laravel 5 version, a lot of developers observed that the Models directory was missing. With this new release Laravel feature, the app directory was introduced. Using this feature, one need not create a folder. One need not require a lot of developers. And need not make an extra nuisance. Laravel 8 comes with an app/models directory that can be restored quickly.

5. Model Factory Classes

Taylor Otwell rewrote the Eloquent model factories as classes. If we compare Laravel 8 vs Laravel 7, then we can better understand the model factor classes.

Laravel 7.x User Factory code:

Laravel 7.x User Factory code:

Laravel 8 User Factory code:

Laravel 8 User Factory code:

With the above code, we can say that Laravel 8 factory classes can extend the base Laravel factory class. Let’s take a look at how Laravel 7 vs Laravel 8 different.

Use factories in Laravel 7

Use factories in Laravel 7

Use factories in Laravel 8

Use factories in Laravel 8

Use factories in Laravel 8.1

6. Job Batching

For Laravel, jobs are tasks that are performed as part of a queue to accomplish something. The Laravel 8 features use new batching functionality with defining jobs. Let’s say, for example, use a simplified batchable unit like given below:

Job Batching

As soon as the batch job is set, you can dispatch a batch in your controller using the batch method of the bus façade.

bus façade

7. Get better Rate Limiting

Here’s the rate-limiting of Laravel 7

Here’s the rate-limiting of Laravel 7

Here’s the rate-limiting of Laravel 8

Here’s the rate-limiting of Laravel 7

Apply to pre-configured rate limiter along with route throttle.

Apply to pre-configured rate limiter along with route throttle.

8. Maintenance Mode

Taylor Otwell contributed to the maintenance mode. In the features of Laravel 8, PHP artisan down maintenance mode. It’s bypass using an allow list that accessed the application. The feature was removed to get a simpler solution. In maintenance mode, one uses the secret option to specify a maintenance mode:

PHP artisan down – – secret = “1630542a-246b-4b66-afa1-dd72a4c43515”

After maintenance mode is placed, one navigates the application URL matching. Laravel uses maintenance mode with bypass cookies to your browser. One can redirect the application route. As soon as a cookie issued to your browser, one can browse the application normally.

9. Pre-Rendering Maintenance Mode

Utilize the PHP artisan down command during deployment. The user can encounter errors while composer dependencies and infrastructure components continue to update. With this Laravel framework, one can determine your application and render the maintenance mode using a template engine. To pre-render a template of your choice using the down command render option.
php artisan down – – render = “errors: : 503”

10. Closure Dispatch / Chain

Use the new catch method and provide a closure that execute if a queue closure fails to complete successfully after exhausting. Check the queue configured retry attempt:

use Throwable;
dispatch(function () use ($podcast) {
$podcast->publish();
})->catch(function (Throwable $e) {
// This job has failed…
});

11. Dynamic Blade Components

Taylor contributed Dynamic Blade Components. There are times when we need to render components but don’t know which component to render until runtime. In this situation, one needs to use Laravel’s dynamic component to render based on a runtime value like:
<x-dynamic-component :component=”$componentName” class=”mt-4″ />

Wrapping up

We have checked new features in Laravel 8, where Taylor and the teamwork hard to add a feature that benefits developers. Talking about Laravel 8, it requires PHP 7.3 and more upgrades. As one of the best Laravel app development companies, we offer the best Laravel shift service or custom-based requirements. If you’re looking for innovative Laravel solutions, hire Laravel developers and grow your business with ease.

In-Depth Laravel 8 New Released Features

Contact Us

 

 


Author image

Disha Aghera

Disha Aghera is a Full Stack Tech Lead. I have developed web applications from scratch and also support existing applications. I have experience in Laravel, CodeIgniter, CakePHP, Zend Framework, Angular, Node JS, etc. I found more things to learn here

Why Our Client Love Us?

Our integrity and process focuses largely on providing every customer the best recommendations for their respective business. Our clients become recurring customers because we always go beyond their expectations to deliver the best solutions.

about-us-strategies

We brainstorm a lot!

Because brainstorming leads to new thoughts & ideas. We believe in discussing & bridging the gap leading to nicer suggestions & application.

about-us-strategies

Believe in Innovation!

Innovation is like Jugaad. It only comes when you give it a try. We believe that extraordinary things come with innovation which help you stand & lead in the crowd.

about-us-strategies

Creative Developers!

Our developers are always keen to develop creative ideas. There is “NEVER a NO.” They have an eye on the market facts, thus develop in the latest on going environment.

about-us-strategies

Value for Money!

We understand the value of money & thus with a modular approach serve you the best quote for your application & web services. The features we promise, we deliver. #notohiddencosts

Trusted By