Unveiling Laravel 11: A Deep Dive into Its Newest Features

1. Slim Skeleton

Laravel 11 introduced a much-anticipated change: the slim application skeleton. This revamp focuses on streamlining the application structure and configuration process, making development more efficient and enjoyable. Let’s delve into the key aspects of the slim skeleton
When you install a new Laravel project, the folder structure will look like this:

Previously, scattered configuration files populated the application structure. Laravel 11 consolidates this. Here’s an example of registering a service provider in bootstrap/app.php:

2.Config Files

By default in Laravel 11, you will see empty config folders. If you want to change the configuration, you can do it using the .env file. However, if you need to make changes to config files, you need to publish them using an artisan command.

Laravel 11 provides the following commands to publish config files.

Laravel Publish Single Config File:

You can run the following command to publish a single config file:

Now, you will have list of config files, choose one and it:

Laravel Publish All Config Files:

You can run the following command to publish all configuration files:

3.Direct tasks scheduling in routes/console.php

Scheduling tasks is now as simple as adding a few lines to your routes/console.php file, thanks to the new Schedule facade. No need for a console kernel anymore.

4.Helth-check endpoint

Laravel 11 introduces a new that allows you to perform various verifications of the different parts of your application and ensure everything is running smoothly.

The endpoint can be defined in bootstrap/app.php like so:

Whenever the endpoint is hit, a Illuminate\Foundation\Events\DiagnosingHealth event is dispatched.

5.Dumpable Trait

Laravel 11 introduces a new Dumpable trait. It is intended to replace the current dd() and dump() methods in most of the framework’s classes. Users and package authors can include this trait for easier code debugging.

Here is the usage example:

6.Optional API and broadcast route files

Not every app needs API and broadcasting capabilities out of the gate. Laravel 11 acknowledges this by not including api.php and channels.php route files by default. Laravel’s flexibility shines here, allowing you to add features only when you need them.

Gone are the default middleware classes

Gone are the days of a cluttered middleware folder. Laravel 11 has moved these middleware into the framework itself, letting you enjoy a cleaner application structure without losing the ability to customize middleware behavior from bootstrap/app.php.

7. Artisan’s New Toy: make:enum Command

Laravel 11’s Artisan CLI offers a make:enum command for swift enum creation. Here’s an example:


This generates an OrderStatus enum class with the specified options.

8. Cleaner Code: The once Method

The once method helps avoid redundant operations on collections. Here’s an example:

This ensures the processing logic executes only once for each unique user in the collection.

By incorporating these new features and exploring the Laravel documentation, you can leverage the power of Laravel 11 to build modern web applications efficiently. Remember, this is just a glimpse into the exciting world of Laravel 11. Keep exploring

Request a Quote


    Baiju M

    Senior Business Developer

    Send us a Mail
    × How can I help you?