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

Serializer Expression Bundle Laravel Package

jlm/serializer-expression-bundle

Integrates Symfony ExpressionLanguage with JMS Serializer so serialization metadata can use dynamic expressions for conditional exposure and exclusion. Lets API responses adapt to context, user roles, or runtime values without custom serialization code. Easy Symfony bundle setup.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature-level: conditional field exposure in API payloads. The pattern this package represents answers a recurring product question — "should this field appear in this response, for this caller?" — via a declarative, per-field rule rather than branching logic scattered through controllers or transformers. That capability maps directly to role-based payload shaping, feature-flagged fields, privacy-driven data minimization, and API versioning/deprecation windows.
  • Data minimization and privacy posture. Hiding fields like ssn, internal cost, moderation state, or email unless the caller is authorized is a compliance-relevant behavior. A declarative, testable exclusion rule is easier to audit and evidence than ad-hoc if ($user->isAdmin()) checks. This is the strongest product argument for the pattern, independent of this specific package.
  • Build vs. buy: the decision here is "neither — configure what we already have." This package is archived, has 4 stars and 0 dependents, and scores 0.075 on the health signal. Adoption means owning an unmaintained dependency for a capability that now ships natively in every relevant ecosystem. Record it as a rejected dependency, not a technical evaluation pending.
  • Ecosystem fit correction. This is a Symfony bundle wired into JMS Serializer, not a Laravel package. For a Laravel codebase it delivers zero product value — Laravel's API Resources ($this->when(), whenLoaded(), $hidden/$visible) already cover the same need. Log this as a fit mismatch in our intake, alongside any other mis-routed Symfony packages.
  • Roadmap signal: the capability gap is closed. Modern JMS Serializer supports expression-driven exclusion natively, and Symfony Serializer covers it with groups and callbacks. This bundle solved a Symfony 2/3-era problem that no longer exists. Useful input when scoping "should we build an internal serialization helper?" — the answer is no; configure the platform.

When to Consider This Package

  • Only in a legacy, frozen Symfony context. A Symfony 2.x/3.x app pinned to an older JMS Serializer that predates native expression-based exclusion, where the serializer upgrade is out of scope for the current cycle and the blast radius is one or two entities.
  • Only with explicit ownership. If adopted at all, it must be vendored or forked with a named internal owner, a pinned version, and a dated exit plan — treat it as a temporary local patch, never a standing dependency.
  • Never as a new-build default. Not on greenfield projects, not on anything with a security or compliance surface, and not on codebases targeting PHP 8+ or current Symfony, since the archived bundle will not track those runtimes.
  • Look elsewhere when: on current JMS Serializer (use native @Exclude(if="...")), Symfony Serializer (groups + #[Ignore] + normalization context), API Platform (serialization groups), or Laravel (API Resources with $hidden/$visible and conditional when* helpers). Also look elsewhere if the real requirement is per-caller payload shape at scale — that's better served by explicit read models/DTOs than by annotations on entities, which couples persistence to presentation.

How to Pitch It (Stakeholders)

Executive summary: We evaluated jlm/serializer-expression-bundle, a small Symfony bundle that adds an expression-based @excludeIf annotation to JMS Serializer so fields can be conditionally omitted from API responses based on runtime context. Recommendation: do not adopt. It is archived with no maintainer, 4 GitHub stars, zero dependent projects, and a health score of 0.075. It is also a Symfony package, not applicable to our Laravel stack. Adopting it would create a permanent unpatched dependency for a capability our platform already provides natively.

For engineering: the capability is worth having; this implementation is not. Laravel API Resources already express conditional fields with closures that are typed, testable, and impossible to inject. Current JMS Serializer ships expression-based exclusion, and Symfony Serializer covers it with groups and callbacks. Cost of the alternative is a few hours of configuration or one read-model class. Cost of adoption is low in code and high in tail risk: vendor/fork overhead, no PHP 8 or modern Symfony compatibility, hot-path expression evaluation without caching, fail-open behavior that can silently leak excluded fields, and a migration we would have to fund ourselves.

The ask: close the evaluation as "capability covered by platform," add the pattern — declarative, context-aware, fail-closed field exclusion — to our serialization guidelines, and require an explicit owner plus exit plan for any future archived-dependency proposal of this shape.

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.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource