microsoft/kiota-serialization-json
JSON serialization library for PHP from Microsoft's Kiota toolchain. Lets Kiota-generated API clients parse and serialize JSON payloads. Install via Composer with microsoft/kiota-serialization-json.
Architecture fit. This is not a general-purpose JSON encoder. It is a pluggable implementation of the microsoft/kiota-abstractions serialization contracts (ParseNode / SerializationWriter factories) that a Kiota-generated PHP client consumes to turn HTTP payloads into typed models. It has value only in conjunction with (a) code generated by the Kiota CLI from an OpenAPI description and (b) a Kiota HTTP request adapter (Guzzle-based) plus an authentication provider. In a Laravel codebase that means it sits at the boundary layer of an outbound API integration, not in the domain or persistence layer. If we are not generating a client with Kiota, this package has no role — Laravel's Http client, JsonResource, or Saloon already cover the same ground with far better ergonomics.
Integration feasibility. Mechanically trivial: composer require microsoft/kiota-serialization-json and it slots in as a constructor argument to the generated client. The real cost is upstream: toolchain install (Kiota CLI, .NET runtime or containerised invocation), OpenAPI source curation, generation, and versioning of generated code. The Dependents: 0 figure and 8 stars are misleading as risk signals — this is a release-only mirror of a subpackage in the microsoft/kiota-php monorepo, so its consumers are generated clients rather than libraries that declare it as a dependency. But they do accurately signal low community mindshare: expect almost no Stack Overflow or blog coverage, and debugging paths that terminate in a read-only mirror repo.
Technical risk.
composer update.addcslashes escaping, float-from-integer coercion, composed (intersection/union) types, and null handling in collections. That is a mature-but-actively-churning correctness surface; regression risk on upgrade is real.kiota-php, not this repo. Any fix we need is upstream-gated with no commercial SLA.Key questions. Which specific API are we integrating (Microsoft Graph is the canonical answer, and it has its own PHP SDK that may make raw Kiota redundant)? Is the target API's OpenAPI description stable and Microsoft-blessed, or internal and likely to drift? Does our PHP runtime baseline support 8.2+ everywhere we would deploy? Who owns regenerating the client when the API changes? Is the team prepared to treat generated code as vendored, non-editable artefact?
Stack fit. Poor-to-neutral as a Laravel-native choice, good as a boundary adapter. Laravel already ships Guzzle via Illuminate\Support\Facades\Http, so the Guzzle 8 support added in 2.2.0 avoids a dependency conflict — but the Kiota client will not use Laravel's HTTP client, so we lose Http::fake() test ergonomics, Laravel's retry/backoff helpers, and the event hooks. Authentication is entirely outside this package: an access-token provider and request adapter must be wired and refreshed manually, meaning we re-implement token caching that Laravel packages normally give us for free. Treat this package as infrastructure behind a hand-written repository/gateway class, never leaking ParseNode types into controllers, jobs, or Blade/Inertia payloads.
Migration path. Greenfield or additive only. There is no sane path from existing hand-rolled Guzzle/Saloon integrations to Kiota unless we are also adopting code generation wholesale — the win is eliminating hand-maintained DTO mapping for a large, fast-moving API surface, and that win only materialises at scale (hundreds of endpoints, frequent schema changes). For a handful of endpoints, this is a net negative.
Compatibility. Requires PHP ≥ 8.2, which aligns with Laravel 11/12. Check transitive constraints against our pinned Guzzle major (7 vs 8) and our microsoft/kiota-abstractions version. Because of synchronised versioning, pin exact versions in composer.json for the whole Kiota set (abstractions, serialization, HTTP adapter) and upgrade them as a single unit — never let Dependabot bump one in isolation.
Sequencing.
App\Generated\...) that is excluded from PHPStan/PSALM baselines and from code-review style rules.kiota-serialization-json, kiota-abstractions, and the Guzzle HTTP adapter as an explicitly pinned set.Http::fake will not intercept the Kiota client — use the adapter's own mocking layer or a fake request adapter).Maintenance. Low code volume, non-trivial upgrade discipline. The mirror repo means we are a consumer of a monorepo release train, and the breaking 2.0.0 PHP-floor change is a preview of how these arrive: bundled with security justification, no deprecation runway. Budget for a recurring quarterly review of the Kiota set as a single upgrade ticket, plus a regeneration step whenever the upstream spec changes. Abandonment risk is low given Microsoft ownership, but attention risk is high (8 stars means our issue is competing with Graph SDK issues for maintainer time).
Support. No vendor SLA. Escalation is GitHub issues on kiota-php and reading the Kiota core docs. Mitigation: keep the generated surface behind our own interfaces so a fallback to hand-written Guzzle/Saloon is a contained rewrite rather than an archaeology project. Maintain at least one engineer with Kiota familiarity — this is a single-point-of-failure skills profile.
Scaling. The package itself is stateless and CPU-bound; it scales horizontally with the PHP workers and adds no I/O, no connection pool, no cache. The scaling concern is memory and allocation on large collections — 2.0.1 specifically reduced parse node allocations for primitive deserialization, so we are on the right side of that curve, but very large JSON responses should still be streamed or paginated at the API layer rather than fully materialised. Under Octane, ensure the generated client and serialization factories are resolved per-request or are genuinely stateless, and that token caches are shared (Redis) rather than per-worker.
Failure modes.
Ramp-up. Steep for the unfamiliar, and mostly front-loaded into concepts rather than code: OpenAPI-derived models, ParseNode navigation, composed types, request adapters, and the Kiota CLI itself. Generated code is verbose and unfriendly to read, which slows onboarding and code review unless the team agrees the generated namespace is untouchable. Estimate roughly one to two weeks before a mid-level Laravel developer is productive, contingent on a clear gateway abstraction and a written regeneration runbook. Without those two artefacts, the ramp-up cost recurs on every API change.
TPM recommendation. Score and adoption signals suggest a niche, low-mindshare, single-purpose dependency. Adopt only if we are integrating a large, spec-described API — realistically Microsoft Graph — where codegen removes meaningful toil. For ordinary third-party REST integration in Laravel, the opportunity cost is negative and this package should be declined in favour of the framework's own HTTP client.
How can I help you explore Laravel packages today?