Laravel officially released on 8th September 2020. We are excited about Laravel 8 Features. There’re few significant improvements done in Laravel 7.x and added to the Laravel 8 upgrade. It introduces Laravel Jetstream, Model Factory classes, Model Directory, Rate-limiting improvement, and many more. It’s necessary to understand Laravel 6 versions before moving ahead with Laravel 8 features. Since the Laravel 6 framework can switch to semantic versioning, we have to understand its process.
Note: Laravel 8 will provide six months bug and security fixes for this version. In addition to this, the Laravel app development has worked on features that no longer have manually restart. Moreover, it has improved maintenance mode, new Bus: dispatch, a big refactor, and a few more great features.
Table Of Contents
- Let’s dive straight to look into what’s new in Laravel 8 Features
- New Landing Page
- Default App Directory
- Route Caching Improvements
- Controllers namespace removed the prefix.
- Blade components Attributes
- Cleaner Syntax for closure based on event listeners
- Queueable Anonymous Event Listeners
- Maintenance Mode: Secret Access
- Maintenance Mode: Pre-Render Pages
- Queued Closure Error Handling
- Exponential Backoff for Job Failures
- Queued Job Batching
- Enhanced Rate Limiting
- Database Schema Dumping
- Brand New model factories
- Laravel JetStream & Laravel Fortify
- Conclusion
Let’s dive straight to look into what’s new in Laravel 8 Features
New Landing Page
The page built with TailwindCSS. It links to SaaS products from Laravel. It has a link to a new Laravel shop. The homepage is well-displayed on a fresh install with a significant facelift.
Default App Directory
Instead of leaving the model class in the root app directory, Laravel 8 will ship an app/model directory. Based on a poll created by Tylor, 80% of developers were building an app directory themselves. However, you can keep the model in-app directory if you prefer and delete the new model directory.
Route Caching Improvements
If you’re already using caching in your app, then this feature will generate PHP file with an array of routes. Laravel is using these routes as it’s faster than the route file you requested.
Controllers namespace removed the prefix.
If you’re using callable syntax in your web.php route file, then Laravel will double prefix your namespaces. It’s a property that removes so one can import controller classes easily from your route file.
Blade components Attributes
If you have an extended the blade component in Laravel 7, then you wouldn’t have the $attributes child button. It has changed in Laravel 8 upgrade as it makes things easier to build and extend components.
Cleaner Syntax for closure based on event listeners
In the previous version, we have to define event class, register, and type-hint the event for the closure. Whereas now in Laravel 8, you’ll skip the event class as the framework would infer it from type hinted argument.
With Laravel 8 upgrade
Queueable Anonymous Event Listeners
With new Laravel 8 Features, we can now send a closure-based job to queue from the model event. Previously, it wasn’t possible unless you create an event class and event listener trait. The new upgrade will make the process quick and easy to use.
Maintenance Mode: Secret Access
In the previous version, to grant access to many people, you have to do it via IP whitelisting. But this isn’t done dynamically. At the same time, you’re changing IP address regularly. Now with Laravel 8, it’s possible as it used a secret flag while you put the site into maintenance mode.
Maintenance Mode: Pre-Render Pages
In Laravel 7, while you put your site into maintenance mode, it’ll run the composer as part of deployment where the application will throw an error rather than maintenance page mode. It’s has solved in Laravel 8. Here, Laravel 8 will pre-render the view and put the site into maintenance mode. The framework won’t load the composer autoload file and no error. Isn’t it great!
Queued Closure Error Handling
It’s possible to send a closure to the queue for the background process. Handling the failure of the process wasn’t ideal in the past version. With Laravel 8, it can able to register a callback to run when a job has failed using catch() method.
Exponential Backoff for Job Failures
With Laravel 8, you can add a backoff method to do your job done. It’ll return an array of integers which decide the wait time between job attempts in case it fails.
Queued Job Batching
It’s one of the powerful features of Laravel 8. It’ll dispatch multiple jobs to queue and process simultaneously. Mainly there are three callbacks available: then(), catch(), finally().
Enhanced Rate Limiting
Now we can define multiple rate limiters via the Ratelimiter façade. It gives name and closure which return the details of the limit. It allows 50 requests to login page across visitors.
Database Schema Dumping
It’s useful for massive application migrations. It’s a new Laravel 8 feature that’ll run database schema and generate SQL file in a directory containing full schema for your database as raw SQL.
Brand New model factories
The feature has rewritten for Laravel 8. It makes an incredibly powerful and easier feature to work with. Several improvements done in model factories will help to create custom methods right on factory class itself.
Laravel JetStream & Laravel Fortify
It’s one of the vast additions that deserve this post. Laravel Jetstream gives a bigger head start in your applications. It comes with two-factor authentication, browser session management, API token management, user profile editing, delete functionality, JavaScript, etc.
Conclusion
Laravel 8 will require PHP 7.3 or above based on upgrade. We, as one of the global Laravel App development company, provide the best Laravel shift service or any custom based requirements. Hire Laravel developer, if you’re looking for innovative Laravel solutions.