Weave 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

Dingo Serializer Switch Laravel Package

liyu/dingo-serializer-switch

Per-request serializer switching for Dingo API in Laravel. Clients choose array, JSON, or custom serializers via header or query parameter, letting one API serve multiple response formats without config changes or extra controllers.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Multi-format API delivery as a feature, not a fork. If the roadmap includes content negotiation (e.g., JSON:API for partner integrations vs. a lean array envelope for internal clients), this middleware makes serializer choice a routing/request concern instead of a global config edit — one codebase, multiple response contracts.
  • API versioning and incremental migration. The highest-value use case: pin v1 routes to the legacy serializer and v2 routes to the new one, then migrate consumers endpoint-by-endpoint. This directly supports a "no breaking changes" compatibility commitment during a versioning initiative.
  • Build vs. buy resolution. Scope is roughly a middleware plus config; the real cost is the edge cases (per-route groups, fallbacks, error responses still using the default serializer). At 48 stars and zero dependents, treat this as reference implementation / accelerator rather than a dependency to bet the platform on — the decision is "adopt for speed" vs. "reimplement ~1 sprint-day," not a strategic vendor choice.
  • De-risks a Dingo-centric architecture decision. If you are already committed to Dingo API for your REST layer, this fills a known gap (Dingo's serializer is configured globally). It is an enabler for a scoped feature, not a reason to adopt Dingo.
  • Use cases worth a ticket: partner-facing format requirements, per-tenant output formats, gradual serializer deprecation, and A/B or pilot exposure of a new response shape to a subset of consumers.

When to Consider This Package

Adopt when:

  • You are already running Dingo API on Laravel and have hit the global-serializer limitation in practice, not in theory.
  • You need serializer selection at the route, route-group, or request level (query param, Accept header, or version prefix).
  • You can vendor, pin, or fork it — MIT license makes this frictionless, and the code surface is small enough to audit in an afternoon.
  • Your team values speed over provenance; the middleware is a means to ship a format-migration feature this quarter.

Look elsewhere / build in-house when:

  • You are not on Dingo. Laravel's native API Resources or Fractal already cover most transformation and format needs; adopting this package would imply adopting a dependency stack you don't otherwise want.
  • You need active maintenance guarantees (security backports, new Laravel/PHP version support). Zero dependents and low star count are adoption signals, not quality signals — but they mean you own the upgrade path.
  • The requirement is broader than serializer switching: response shaping, sparse fieldsets, pagination contracts, or error-format standardization will need work beyond this package.
  • You are planning to exit Dingo in the next 12–18 months; adding a Dingo-tied dependency deepens the coupling you're trying to unwind.

How to Pitch It (Stakeholders)

For executives: A small, MIT-licensed utility that lets one API serve multiple response formats per route. The business value is contract stability during API versioning — we can ship a new response format to new consumers while existing integrations keep working, avoiding a flag-day migration and the support load that comes with it. Cost is negligible; the main consideration is that it's a lightly-adopted package, which we mitigate by pinning or vendoring the ~small amount of code. Treat it as a tactical accelerator, not a platform bet.

For engineering: Already on Dingo? This solves the global-serializer constraint via middleware, so format becomes a per-route decision. It's a thin layer over Dingo's serializer registry — cheap to audit, easy to fork, and safe to pin. Prefer it when the alternative is duplicating controllers per format. Don't adopt it as a reason to introduce Dingo, and don't let it block an eventual move to native Laravel resources — isolate the usage behind our route config so it's removable.

Recommendation: Time-box a spike (1–2 days) to validate it against our actual route groups, error responses, and versioning plan. If the spike passes, vendor it under our namespace, pin the version, and add an owner to the dependency register.

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.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums