Symfony 7.3 may be a “minor” release, but these five additions will shave boilerplate off everyday code, boost performance where it hurts and generally make life nicer for Symfony developers.
ObjectMapper component
Stop hand-writing tedious DTO <-> Entity mapping code. The new ObjectMapper can:
- create or update a target object in one line
($mapper->map($dto, User::class))
, - use
#[Map]
attributes for per-property rules (target
,transform
, conditional mapping…), - handle nested graphs, cycles and service-based transformers.
Marked experimental but already very usable, especially for Hexagonal or CQRS architectures.
https://symfony.com/doc/7.3/object_mapper.html
JsonPath component
Think DomCrawler for JSON. Build a JsonCrawler, then query with RFC 9535-compliant JSONPath strings or a fluent builder. Handy for quick data extraction, powerful filters (?(@.price < 10)
), and function support length()
, match()
etc.
https://github.com/symfony/json-path
JsonStreamer component
If your API shovels huge JSON payloads, meet JsonStreamer: a streaming encoder/decoder that’s about 10× faster and 50–90 % lighter on memory than the Serializer when you only need JSON. It relies on generators, works hand-in-hand with the new TypeInfo component and already powers API Platform benchmarks.
https://symfony.com/components/JsonStreamer
Namespaced Caches
All cache adapters now implement NamespacedPoolInterface
, giving you withSubNamespace('foo')
. Instead of inventing key prefixes yourself, you can group related items into logical “sub-pools” and invalidate (or clear) the whole namespace in one call – cleaner than tags when the grouping is hierarchical.
Messenger improvements
Messenger gets several quality-of-life upgrades:
- Deduplication middleware – drop-in protection that ignores identical messages already waiting in the queue – perfect when multiple events fire for the same payload,
RunProcessMessage::fromShellCommandline()
– dispatch shell commands with pipes/redirects without wrapping them yourself,- Doctrine keep-alive (
--keepalive
) – prevent long-running handlers using the Doctrine transport from being redelivered, - CloseableTransportInterface – call
close()
to free resources in AMQP/Redis/SQS transports from inside a worker, --class-filter
for messenger:failed:remove – Delete only the failed messages of a given class.
https://symfony.com/doc/7.3/messenger.html
Symfony 7.3 brings a ton of smaller but impactful improvements, better locale resolution and debug output in the Router, stricter and more predictable behavior in YAML parsing, enhancements to Console UX, and many others sprinkled throughout the framework.
Leave a Reply