I am very excited about new Symfony release. Lot’s of things changed. This post puts everything in one place and highlights the most important changes.
Dependency Injection component
The dependency injection component had many changes. To improve RAD the service autoconfiguration was added as well as getters autowiring and getters injections. In my opinion, the most sexy change is adding the optional class for named services. It allows you to create a service without adding the direct class name.
In your controller/service, you can just retrieve it using the simple syntax
Full list of the changes with explanation you can find here.
Who likes upgrading libraries/frameworks? Nobody? That’s what I thought. Symfony added to his awesome developer toolbar a new tab with all deprecations.
We have few new components:
Symfony supports the HTTP/2 even better and lets us link resources so they may be prefetched to increase loading of the websites.
This new component was experimentally added to Symfony 3.3 but was removed for now and will have his second chance in Symfony4.
Thanks to this component, loading from .env files is now built-in into Symfony. It helps to develop and manage configuration without deploying on production.
Do you like the PHP built-in server? Symfony uses it for a while and decided to move the functionality to a separate bundle.
This component had not so many changes. The changes that are worth stressing are: adding support for defining custom YAML tags and reading config with glob patterns. The way we can get project’s root is simpler now.
They are many of other improvements. Most of them are listed below:
- Security bundle improvments
- Redesigned exception pages (they are more pretty now!)
- Routing works fasterer
- It is simpler to get flashes in templates
- Workflow improvments got some improvements, too like new twig function workflow_has_marked_place() or a new entered event.
- Kernel build method was added to make creating apps without own bundles easier
- Search in dumped content – if you want to be able to search in your dumps, do not be a lama and use VarDumper component!
Symfony follows backward compatibility promise, but from time to time they must break it to fix a security issue. This time it happened and trusted_proxis configuration key was removed.
UPDATE: The “trusted proxies” configuration was reverted because it caused problems with deploying applications with different proxy configuration on test, stage and prod env.