microsoft/kiota-serialization-form
PHP application/x-www-form-urlencoded serialization library for Microsoft Kiota generated SDKs. Adds support for form-encoded request/response payloads from compatible API endpoints; install via Composer and use alongside Kiota PHP projects.
application/x-www-form-urlencoded payloads. If the Laravel application interacts with Microsoft Graph API, Azure, or other Kiota-supported APIs, this package provides a native serialization layer for form-encoded requests/responses.application/x-www-form-urlencoded via FormRequest or multipart/form-data. However, if the backend uses Kiota-generated models, this package ensures consistent serialization/deserialization between API contracts and HTTP payloads.http_build_query), this package standardizes the process and aligns with Kiota’s abstraction layer.microsoft/kiota-http (or similar Kiota core packages) for full functionality. If the Laravel app already uses Kiota, integration is straightforward. If not, additional setup is needed.| Risk Area | Assessment |
|---|---|
| Version Lock-In | Kiota PHP ecosystem is monorepo-driven; version mismatches may cause issues. |
| Performance Overhead | Minor allocations optimized in v2.0.1, but not a bottleneck for typical use cases. |
| Boolean Parsing | Fixed in v2.0.1 ('false' → false), but edge cases (e.g., null values) may need validation. |
| Laravel Ecosystem Gap | No native Laravel integrations (e.g., no HttpClient middleware). Manual wiring required. |
| Long-Term Support | Microsoft maintains Kiota, but PHP 8.2+ only may limit adoption in legacy Laravel apps. |
http_build_query is used, assess refactoring effort vs. benefits.application/x-www-form-urlencoded (e.g., for REST APIs with form payloads).Http facade or Guzzle directly, but Kiota’s RequestInformation must be adapted.http_build_query: Less type-safe, no Kiota integration.FormEncoder: Overkill for simple form data.FormRequest: Limited to HTTP requests, not model serialization.$this->app->bind(KiotaFormSerializer::class, function ($app) {
return new KiotaFormSerializer();
});
null, nested objects) with existing Laravel tests.| Component | Compatibility Notes |
|---|---|
| Laravel HTTP Client | Works, but requires manual binding to Kiota’s RequestInformation. |
| Guzzle | No direct integration; use as a pre-request transformer. |
| Laravel Validation | Compatible; form data can be validated via FormRequest. |
| Kiota Models | Native support; ensures serialization matches API contracts. |
| PHP 8.2+ | Required for v2.x; v1.x drops support for PHP <8.2. |
http_build_query.null values).RequestInformation logging, Laravel’s tap() for payload inspection.| Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Kiota Model Mismatch | Serialized form data doesn’t match API contract. | Use Kiota’s RequestInformation validation or Laravel’s FormRequest. |
| Unsupported Data Types | Nested objects/arrays fail to serialize. | Implement custom serializers or pre-process data. |
| Boolean/Null Parsing Errors | 'false' → false fails (fixed in v2.0.1), but other edge cases may exist. |
Test with comprehensive payloads; extend FormParseNode if needed. |
| PHP Version Incompatibility | Laravel runs PHP <8.2, but package requires v2.x. | Downgrade to v1.5.2 or upgrade PHP. |
| Middleware Conflicts | Kiota serialization clashes with Laravel’s HTTP middleware. | Isolate Kiota requests via route middleware or custom client. |
How can I help you explore Laravel packages today?