Laravel 5.6 new features

The Laravel 5.6 release is now officially available as the next major version of the Laravel framework! This release has many new features, and we’ve highlighted the more prominent features here. For a full list of all changes visit the changelog (GitHub).


Logging Improvements

The biggest feature in Laravel 5.6 release is the logging improvements. For starters, v5.6 logging configuration moves from the config/app.php file to the new config/logging.php file.

You configure “stacks” that can send log messages to multiple handlers. For example, you might send all debug messages to a system log and send error logs to slack.

You can read more about configuring and customizing logs by visiting the logging documentation.

Single Server Task Scheduling

If you have a task scheduler running on multiple servers, the task will run on each server. You can indicate that a task should only run on one of those servers with the onOneServer() method:


Note: you must use the memcached or redis cache driver as the default application cache driver to take advantage of single server task scheduling in the Laravel 5.6 release.

Dynamic Rate Limiting

Laravel 5.6 introduces dynamic rate limiting that gives you more flexibility and makes it possible to easily rate limit on a per-user basis:

Route::middleware('auth:api', 'throttle:rate_limit,1')
    ->group(function () {
        Route::get('/user', function () {

In the above example, the rate_limit is an attribute of the App\User model to determine the number of requests allowed in the given time limit.

Broadcast Channel Classes

You can now use channel classes in your routes/channels.php file instead of using closures.

To generate a new channel class, Laravel 5.6 provides a new make:channel command:

php artisan make:channel OrderChannel

You register your channel in the routes/channels.php file like so:

use App\Broadcasting\OrderChannel;

Broadcast::channel('order.{order}', OrderChannel::class);

API Controller Generation

You can now generate a resource controller for APIs that will exclude the unnecessary create and edit actions, which only apply to resource controllers returning HTML. To generate a resource controller, use the --api flag:

php artisan make:controller API/PhotoController --api

Eloquent Date Casting

You can individually customize the format of Eloquent date and datetime casting:

protected $casts = [
    'birthday' => 'date:Y-m-d',
    'joined_at' => 'datetime:Y-m-d H:00',

Blade Component Aliases

You can now alias blade components for more convenient access. For example, if you store a component at resources/views/components/alert.blade.php you can use the component() method to alias it to a shorter name:

Blade::component('components.alert', 'alert');

You can then render it with the defined alias:

    <p>This is an alert component</p>

Argon2 Password Hashing

Laravel 5.6 supports a new password hashing algorithm for PHP 7.2+. You can control which hashing driver is used by default in the new config/hashing.php configuration file.

UUID Methods

Two new methods are now available in the Illuminate\Support\Str class for generating Universal Unique Identifiers (UUID):

// The methods return a Ramsey\Uuid\Uuid object

return (string) Str::uuid();

return (string) Str::orderedUuid();

The orderedUuid() method will generate a timestamp first UUID for easier and more efficient database indexing.


Collision is a package designed to give you beautiful error reporting when interacting with your app through the command line. Starting in Laravel 5.6, Collision will now come preinstalled as a dev composer dependency.

This means you’ll get nice error reporting in your terminal like this:

Behind the scenes, Collision is built on top of the Whoops error handler, which made a comeback in Laravel 5.5.For more information on Collision check out the Github repo and you can even start using it today by manually installing.

Bootstrap 4

Now Bootstrap 4 shipping with Laravel 5.6.

0 0 vote
Article Rating
Share this: