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

Json Encoder Bundle Laravel Package

mtarld/json-encoder-bundle

Symfony bundle that integrates mtarld/json-encoder into your app, letting you encode and decode PHP objects to and from JSON with support for denormalization, validation, and typed collections.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. This is a Symfony bundle, not a framework-agnostic library. Its value proposition is compile-time generation of JSON encoders/decoders from PHP class attributes, eliminating the runtime reflection cost that Symfony Serializer, JMS Serializer, and Laravel's own JsonResource layer incur. That's a real but narrow benefit. The architectural mismatch is significant: Laravel has no bundle system, no kernel compiler passes, and no container compilation phase analogous to Symfony's. The bundle's core mechanism—a DI compiler pass that walks the codebase and emits encoder classes—has no natural insertion point in a Laravel lifecycle. In practice you would not install this bundle at all; you would reach for the underlying mtarld/json-encoder package and hand-wire generation as a build step. At that point you're maintaining an integration the author never designed or documented.

Integration feasibility. Feasible but manual. Attributes live on domain/DTO classes; a Composer script or artisan command invokes the generator; output is autoloaded and registered in a service provider. Laravel's container resolves by class name, so wiring works. There is no Laravel service provider, no config file, no Laravel-oriented documentation, and zero evidence anyone has done this. Expect a spike to surface issues the package author never encountered.

Technical risk: high. Four independent signals compound here: archived repository (no patches, no PHP 8.4/8.5 guarantees, no fixes for breaking transitive dependencies like nikic/php-parser), 10 stars, zero dependents, and a score of 0.04. That combination means no community validation, no StackOverflow answers, no third-party battle testing, and a bus factor of one—who has already stopped. Code generation also introduces a build artifact that must be regenerated deterministically and kept in sync with model changes; drift is a silent failure mode.

Key questions.

  • Have we benchmarked serialization against Laravel API Resources or Spatie Data and found it materially too slow? If not, this dependency buys nothing.
  • If we adopt, who owns the fork, and what is the review cadence for PHP-version compatibility?
  • Which PHP and Laravel versions must this survive for the feature's expected lifetime, and does the archived dependency range resolve against them?
  • Does the generated decode path safely handle untrusted request payloads (type coercion, unknown properties), and who signs off on that?
  • What is the exit cost if we standardize and later migrate to a maintained library?
  • Which team member becomes the single point of failure, and is that acceptable?

Integration Approach

Stack fit. Poor to moderate. Symfony-native, Laravel-adjacent. Laravel 10/11 on PHP 8.1–8.3 is probably workable for the standalone generator; anything newer is unverified. The honest comparison set is Illuminate\Http\Resources, spatie/laravel-data, a Symfony Serializer bridge, or hand-written hydrators. Evaluate those first—they are maintained and staffed by people other than us.

Migration path. If pursued: add mtarld/json-encoder as a require-dev, run generation in CI via a Composer script or artisan command, emit into a dedicated namespace, register generated classes in a service provider. Do not attempt to load the bundle itself in Laravel—the bundle registration and kernel wiring will not resolve. If we are already on Symfony Serializer or API Resources, this is a parallel path, not a migration; that doubles the serialization surface and should be a hard stop.

Compatibility. Archived as of March 2024. Pinned Symfony and parser dependency ranges will likely conflict with current Symfony 7.x and Laravel 11.x releases. Composer resolution failures mid-project are the expected first incident, not a tail risk.

Sequencing.

  1. One-to-two day spike: one representative model, generation wired end-to-end, benchmark against API Resources.
  2. Prove deterministic generation in CI with a diff check before writing any production code.
  3. If adopted, place it behind an internal encoder interface so the implementation is swappable without touching call sites.
  4. Keep the package's attributes confined to the transport/DTO boundary; domain code must not reference them.
  5. Set a review date at six months to reassess against a maintained alternative.

Recommendation: do not adopt for production. Treat as a reference implementation or a benchmark baseline. If generated serializers are genuinely required for performance, fund an internal fork with a named owner and explicit exit criteria, or select a maintained library.

Operational Impact

Maintenance. Archived means we own it outright. Budget for a fork, version pins, and periodic patching for PHP minors and transitive CVEs—none of which appears in any vendor roadmap. The regeneration step becomes a permanent CI obligation with an owner and code review, since generated code is reviewed like hand-written code or it isn't reviewed at all.

Support. No upstream triage, no issue responses, no security advisories. Escalation is internal only, which concentrates risk in whichever engineer learns the generator internals. That person's departure is a project-level event.

Scaling. Technically fine—generated encoders are stateless and fast, which is the entire point. Generation time grows linearly with model count and won't matter at realistic sizes. Organizationally it does not scale: no docs, no examples, no community to consult. Every new hire ramps from source code.

Failure modes.

  • Silent desync between model attributes and stale generated code—wrong or missing fields in responses, decode failures on requests. Most likely and least detectable.
  • Dependency resolution breakage on a PHP or Laravel upgrade, typically discovered mid-sprint.
  • Untrusted-input handling in the decode path—type coercion and unknown-property behavior need explicit review and fuzzing before exposure to public traffic.
  • Refactor breakage when attributes are renamed and the generation step is skipped in a given pipeline, producing no compile error.

Ramp-up. Three to five days for a senior PHP engineer to be productive; longer to be confident. The mental model is simple, but with no documentation the learning is archaeological. Onboarding cost stays elevated for the life of the dependency because there is nothing external to point people at.

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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console