4.2.12

Latest release in branch 4.2
Released 6 years ago (November 13, 2019)

Software Symfony
Branch 4.2
Status
End of life
End of bug fixes July 2019
End of security fixes July 2019
First official release version 4.2.0
First official release date 7 years ago (November 30, 2018)
Supported
PHP versions
PHP ≥ 7.1.3
Release notes https://github.com/symfony/symfony/releases/tag/v4.2.12
Source code https://github.com/symfony/symfony/tree/v4.2.12
Documentation https://symfony.com/doc/current/index.html
Download https://symfony.com/download
Symfony 4.2 Releases View full list

What Is New in Symfony 4.2

Symfony 4.2 introduces a set of new components, significant improvements to existing ones, and several deprecations to prepare for future versions. The focus is on modernizing the framework with better developer tools and more powerful abstractions.

Category Key Changes
New Components Mailer, Messenger, HttpClient (experimental)
Improvements Workflow enhancements, improved DX with VarDumper, Console, and Web Profiler updates
Deprecations Several classes/methods deprecated in Security, Form, Validator, and Yaml components
Bug Fixes Various fixes across multiple components

What are the major new components in Symfony 4.2?

Symfony 4.2 ships with three brand-new components, two of which are stable. The Mailer component replaces Swiftmailer as the modern solution for sending emails, featuring a pluggable transport system. The Messenger component provides a message bus and handling for queuing and processing messages asynchronously.

Additionally, an experimental HttpClient component is introduced. It offers a fast and versatile HTTP client built for modern PHP, supporting both synchronous and asynchronous requests. This is a game-changer for making external API calls within Symfony applications.

How does the Workflow component improve in 4.2?

The Workflow component receives major upgrades for modeling complex business processes. It now supports state machines alongside the existing workflow nets, giving you the right tool for different scenarios. The new MetadataStore allows you to attach custom data to transitions and places, like labels for UI or validation rules.

You can also define multiple workflows for the same subject, which is practical for managing different aspects of an entity, like its editorial status and publishing lifecycle separately. These changes make the component far more flexible for real-world use cases.

What developer experience (DX) improvements are included?

Several tools get quality-of-life upgrades. The VarDumper component introduces a new dd() function that dumps variables and immediately exits, a faster alternative to dump(); die;. The Web Profiler toolbar now includes a button to quickly clear the cache, saving a trip to the terminal.

The Console component adds a ProgressBar method to handle indeterminate progress for tasks with an unknown duration. Furthermore, the AbstractController gets a new renderForm() method that simplifies form rendering and submission handling in a single call.

Deprecations to Watch For

This release prepares the codebase for Symfony 5.0. Notable deprecations include the security.context service (use security.token_storage and security.authorization_checker), the Yaml::parse() shortcut (use the yaml service), and the allow_extra_fields option in Forms (use allow_extra_fields on the specific field).

In practice, running your application with the Symfony Profiler or using the bin/console debug:container --deprecated command will highlight these changes in your code. Addressing them now eases the future upgrade path.

FAQ

Should I use the new HttpClient component in production?
The HttpClient is marked as experimental in 4.2. Its API might change before becoming stable. For production-critical features, stick with Guzzle or another stable client for now, but feel free to test HttpClient in non-critical paths.

I use Swiftmailer. Do I need to switch to Mailer immediately?
No. Swiftmailer remains fully functional and is still the default in 4.2. However, the new Mailer component is the recommended path forward. You can start migrating at your own pace, as both can coexist.

What's the main advantage of the Messenger component?
It standardizes and simplifies sending and handling messages, especially for async processing. You can dispatch a message and let different handlers process it, or route it to transport (like a queue) to be handled later, decoupling your application logic.

How do I use the new dd() function?
It's available globally in any Symfony application. Just call dd($variable); and it will dump the variable in the VarDumper style and stop script execution. It's a great debugging shortcut.

Are there any changes to how I define services in 4.2?
The core service configuration remains stable. The main changes are under-the-hood optimizations and deprecations of some older patterns. Your existing services.yaml file should continue to work without modification.

Releases In Branch 4.2

Version Release date
4.2.12 6 years ago
(November 13, 2019)
4.2.11 6 years ago
(July 28, 2019)
4.2.10 6 years ago
(June 26, 2019)
4.2.9 6 years ago
(May 28, 2019)
4.2.8 6 years ago
(May 01, 2019)
4.2.7 6 years ago
(April 17, 2019)
4.2.6 7 years ago
(April 16, 2019)
4.2.5 7 years ago
(April 02, 2019)
4.2.4 7 years ago
(March 03, 2019)
4.2.3 7 years ago
(February 03, 2019)
4.2.2 7 years ago
(January 06, 2019)
4.2.1 7 years ago
(December 06, 2018)
4.2.0 7 years ago
(November 30, 2018)
4.2.0-RC1 7 years ago
(November 26, 2018)
4.2.0-BETA2 7 years ago
(November 16, 2018)
4.2.0-BETA1 7 years ago
(November 03, 2018)