coosos/jms-serializer-bidirectional-relation
Adds JMS Serializer subscribers that embed a _mapping_bidirectional_relation in serialized data so bidirectional associations can be restored on deserialize. Supports Symfony or standalone setup via event subscribers, with annotations to enable mapping on root models and exclude fields.
User → Roles ↔ Permissions) are a core requirement but not natively supported.Order → Items ↔ Categories).User ↔ Groups).setX() calls during deserialization.For Executives:
"This package automates the tedious task of maintaining bidirectional relationships in serialized data (e.g., APIs, imports). For example, when saving an Order with Items, it ensures Item.order and Order.items stay in sync without manual code. This reduces bugs in complex systems like e-commerce or CMS platforms, saving dev time and improving data integrity. The trade-off? Minimal maintenance risk (MIT license) but a niche focus on JMS Serializer—ideal if we’re already using it."
For Engineering:
*"If we’re using JMS Serializer and need to deserialize objects with circular/bi-directional references (e.g., User ↔ Roles), this package adds a _mapping_bidirectional_relation key to serialized payloads, automating the inverse property population. Setup is lightweight (2 event subscribers), but note:
setParent() calls; works with annotations.How can I help you explore Laravel packages today?