What Is New in Symfony 4.4
Symfony 4.4 is a Long Term Support release packed with new features that bridge the gap to Symfony 5.0. It introduces new components, deprecates old patterns, and adds numerous quality-of-life improvements while maintaining full backward compatibility.
| Category | Key Changes |
|---|---|
| New Features | New Mailer and Notifier components, improved container compilation, new expression language functions. |
| Improvements | Better PHPDoc support in the container, enhanced translation commands, smoother Messenger integration. |
| Deprecations | Methods and services related to the old Mailer, MimeType guesses, and some security voters are marked for removal in 5.0. |
| Bug Fixes | Numerous fixes across the Form, Validator, Security, and Console components. |
How does the new Mailer component improve my application?
The new symfony/mailer component replaces Swift Mailer, offering a more modern and integrated approach. It's built from the ground up for Symfony's HttpClient and Messenger components, enabling asynchronous sending and better debugging out of the box.
In practice, this means your emails can be handed off to a message queue instantly. The configuration is also more streamlined, with DSN strings for different transports like SMTP or third-party services.
Example Configuration
# .env
MAILER_DSN=smtp://user:[email protected]:465
What can I do with the new Notifier component?
The Notifier component is a unified system for sending alerts across various channels like Slack, SMS, and email. It's designed for application notifications, such as user alerts or system monitoring, rather than marketing emails.
You can use it to send the same notification through multiple channels simultaneously. It integrates tightly with the new Mailer and the existing Messenger component for queued delivery.
Are there improvements for dependency injection?
Yes, the service container gets smarter about PHPDoc. It can now automatically register classes as services based on type hints in your constructor arguments, reducing manual configuration.
This change makes working with auto-wiring even smoother. The container compiler also runs faster in the development environment, which speeds up page reloads during development.
What deprecations should I watch out for?
Several features are soft-deprecated to prepare for Symfony 5.0. Key areas include the old SwiftmailerBundle, certain methods in the MimeType guesser, and the security.user.provider.in_memory factory.
Running your application with the SYMFONY_DEPRECATIONS_HELPER environment variable is the best way to catch these. The deprecation messages usually point you directly to the replacement.
FAQ
Is Symfony 4.4 a good choice for a new project?
Absolutely. As an LTS release, it will receive bug fixes until 2024 and security fixes until 2026. It's stable and includes all the modern features that lead into Symfony 5 and 6.
How difficult is it to migrate from Swiftmailer to the new Mailer?
The process is straightforward. You install the new component, update your configuration to use DSNs, and change a few class names in your code. The underlying logic for building emails remains similar.
Can I use the Notifier without Messenger?
Yes, the Notifier can send notifications immediately. However, using it with Messenger is recommended for any channel that might be slow (like SMS) to prevent your web requests from blocking.
What happens if I ignore the deprecation warnings?
Your application will keep working in 4.4. However, it will break when you try to upgrade to Symfony 5.0, as the deprecated code is removed there. It's best to address them gradually.
Are there performance improvements in this release?
While not a major performance overhaul, several components see optimizations. The faster container compilation in dev mode is a noticeable quality-of-life improvement for developers.