5.1.33

Latest release in branch 5.1
Released 10 years ago (April 05, 2016)

Software Laravel
Branch 5.1
Status LTS
End of life
End of bug fixes June 09, 2017
End of security fixes June 09, 2018
End of life November 30, -0001
First official release version 5.1.0
First official release date 10 years ago (June 09, 2015)
Supported
PHP versions
PHP ≥ 5.5.9
Release notes https://github.com/laravel/laravel/releases/tag/v5.1.33
Source code https://github.com/laravel/laravel/tree/v5.1.33
Documentation https://laravel.com/docs
Download https://laravel.com/docs/master/installation
Laravel 5.1 Releases View full list

What Is New in Laravel 5.1

Laravel 5.1 introduces foundational upgrades that solidify its structure for modern application development. The update is built on long-term support and brings key features like event broadcasting and middleware parameters.

Category Key Changes
New Features Event Broadcasting, Middleware Parameters, LTS Release
Improvements Testing Helpers, Artisan Command Structure, Database Stack
Structural PSR-2 Compliance, Empty Directories in Git

What are the major new features in 5.1?

Event broadcasting and middleware parameters are the headline additions. Event broadcasting allows your server-side Laravel events to be broadcast to client-side JavaScript frameworks using Pusher or Redis, enabling real-time user interfaces.

Middleware parameters let you pass additional context to your middleware. Instead of just having access to the request, you can now define middleware that accepts extra parameters, making them more flexible and reusable for different scenarios.

This version is also a Long Term Support (LTS) release, meaning it will receive bug fixes for two years and security fixes for three years. In practice, this makes it a stable foundation for large-scale, long-running projects.

How did testing improve in this release?

Laravel 5.1 added several new testing helpers to streamline the process of writing tests. The withoutEvents() and withoutMiddleware() methods allow you to disable events and middleware for a single test method, giving you more precise control over your test environment.

You can also now easily test that events are fired without executing their listeners, which is useful for isolating the behavior you're actually testing. These helpers remove common boilerplate code from your tests, making them cleaner and more focused.

What changes were made to the Artisan command line tool?

The structure for defining Artisan commands was simplified. In previous versions, you had to extend the Command class and define a fire method. Now, you extend Command and define a simpler handle method, which is automatically called by the framework.

This change reduces cognitive overhead and aligns with the typical command pattern. It's a small but welcome cleanup that makes creating custom commands more intuitive.

Were there any underlying structural updates?

The entire framework's codebase was updated to follow the PSR-2 coding standard. This ensures a consistent style across all framework files and makes it easier for developers to read and contribute to the Laravel source code.

Empty directories are now also included in the Git repository. Directories like app/Jobs and app/Events are committed even if empty, providing a clearer starting point for developers to add their own classes without having to create the folder structure first.

How did the database layer get better?

Database improvements focused on testing and flexibility. You can now easily test if emails were sent without actually sending them, which is crucial for keeping your test suite fast and reliable.

The update also improved the stack trace for database queries, making it easier to pinpoint exactly where in your code a particular query was executed. This is a huge time-saver when debugging complex performance issues or unexpected query behavior.

FAQ

What does LTS mean for Laravel 5.1?
LTS stands for Long Term Support. This means Laravel 5.1 will receive critical bug fixes for two years and security updates for three years from its release date, making it a stable choice for enterprise applications.

Can I use Laravel Echo with 5.1?
While event broadcasting was introduced in 5.1, Laravel Echo is a later tool. You can use Pusher or Redis directly for real-time features in 5.1, but Echo itself came in a subsequent release.

Do I have to use the new handle method for Artisan commands?
Yes, for new commands created in 5.1. The old fire method was replaced by the handle method. Existing commands will need to be updated to the new signature.

Is upgrading from 5.0 to 5.1 difficult?
The upgrade is generally straightforward. The main tasks involve updating your composer.json file and following the upgrade guide to adjust any deprecated code, like Artisan command methods.

Why are empty directories now in the Git repo?
This change provides a more complete project structure out-of-the-box. It helps newcomers understand the intended organization and saves a step when creating new Jobs, Events, or other classes.

Releases In Branch 5.1

Version Release date
5.1.33 10 years ago
(April 05, 2016)
5.1.11 10 years ago
(August 30, 2015)
5.1.4 10 years ago
(July 01, 2015)
5.1.3 10 years ago
(June 23, 2015)
5.1.1 10 years ago
(June 11, 2015)
5.1.0 10 years ago
(June 09, 2015)