Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Jms Serializer Bidirectional Relation Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Enables seamless bidirectional relation handling in serialized/deserialized data (e.g., parent-child relationships in APIs, CMS content, or e-commerce product hierarchies). Reduces manual mapping logic in controllers/services.
  • Roadmap Alignment: Critical for projects adopting JMS Serializer where bidirectional relations (e.g., User → Roles ↔ Permissions) are a core requirement but not natively supported.
  • Build vs. Buy: Avoids reinventing serialization logic for complex object graphs, saving dev time. Justifies adoption if the team already uses JMS Serializer.
  • Use Cases:
    • APIs: Maintain consistency between nested resources (e.g., Order → Items ↔ Categories).
    • Data Migration: Restore relationships during import/export (e.g., CMS content with hierarchical metadata).
    • Event-Driven Systems: Reconstruct state from serialized events (e.g., audit logs with parent-child references).

When to Consider This Package

  • Adopt if:
    • Your PHP stack uses JMS Serializer (not Symfony Serializer or other libraries).
    • Bidirectional relations are critical (e.g., many-to-many with inverse properties like User ↔ Groups).
    • You need automated mapping to avoid manual setX() calls during deserialization.
    • The package’s MIT license aligns with your project’s open-source policy.
  • Look elsewhere if:
    • You’re using Symfony’s native Serializer (this package is JMS-specific).
    • Your relations are unidirectional or handled via DTOs/DTO builders.
    • The last release (2020) is a red flag for long-term maintenance (evaluate risk tolerance).
    • You prefer active libraries (0 stars/dependents may indicate low adoption).
    • Your team lacks PHP/JMS Serializer expertise (steep learning curve for setup).

How to Pitch It (Stakeholders)

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:

  • Pros: No more manual setParent() calls; works with annotations.
  • Cons: Last updated in 2020 (assess risk); JMS-only (not Symfony’s serializer). Recommend evaluating if this aligns with our serialization strategy or if we should invest in a more maintained alternative."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor