Weave Code
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
Kiota Serialization Text

Kiota Serialization Text Laravel Package

microsoft/kiota-serialization-text

Text/plain serialization/deserialization library for PHP projects generated with Microsoft Kiota. Adds support for handling plain text request/response bodies as a Kiota serialization implementation; install via composer (microsoft/kiota-serialization-text).

View on GitHub
Deep Wiki
Context7

Text serialization provider for Kiota clients in PHP

Frequently asked questions about Kiota Serialization Text
Can I use this package with Laravel’s built-in HTTP client (Guzzle) for non-Kiota APIs?
No, this package is *only* for Kiota-generated PHP clients. Laravel’s HTTP client (Guzzle) uses a different architecture, so you’d need to rewrite your API calls to use Kiota first. If you’re not already using Kiota, this package won’t work without significant refactoring.
What Laravel versions does this package support?
This package itself has no direct Laravel version requirements—it’s a Kiota dependency. However, Kiota-generated clients (e.g., Microsoft Graph SDKs) typically work with Laravel 8+ due to PHP 8.x dependencies. Always check the Kiota PHP repo for compatibility notes.
How do I configure this serializer for a Kiota client in Laravel?
After installing via Composer, initialize a `TextSerializationWriter` in your Kiota client’s `RequestInformation`. Example: `$writer = new TextSerializationWriter(); $requestInfo = new RequestInformation(new Uri('https://api.example.com'), 'POST', $writer);`. Bind this to Laravel’s service container if reused across requests.
Will this break existing JSON/XML serialization in Kiota clients?
No, this package only affects `text/plain` content types. Kiota’s default serializers (e.g., JSON) remain unchanged. You can mix this serializer with others in the same client by configuring `RequestInformation` per endpoint.
Is this package suitable for parsing CSV or legacy plain-text APIs in Laravel?
Yes, if you’re using Kiota-generated clients. This serializer converts raw `text/plain` responses (e.g., CSV, logs, or legacy systems) into structured PHP objects. For non-Kiota APIs, you’d need a separate parser like `league/csv` or custom logic.
Are there performance concerns with plain-text serialization vs. JSON?
Plain-text parsing (e.g., CSV, logs) is generally slower than JSON due to lack of schema validation. Benchmark your use case—Kiota’s text serializer adds minimal overhead, but large payloads may require optimization (e.g., streaming). JSON remains faster for structured data.
Can I use this with Microsoft Graph API in Laravel?
Absolutely, if you’re using Kiota-generated Microsoft Graph clients. This package enables handling `text/plain` responses (e.g., for certain Graph endpoints or custom APIs). Install it alongside `microsoft/kiota-php` and configure the serializer as needed.
What happens if the API returns malformed plain text? Does it throw exceptions?
Yes, the serializer validates input and throws exceptions for malformed text (e.g., invalid encoding, truncated data). Handle these in your Laravel exception handler or middleware. Test edge cases like empty strings or non-UTF-8 text.
Are there alternatives to this package for plain-text APIs in Laravel?
If you’re *not* using Kiota, alternatives include custom Guzzle middleware, `league/csv`, or `symfony/serializer`. For Kiota users, this is the official Microsoft-maintained solution. Avoid reinventing the wheel unless you need Kiota-agnostic flexibility.
How do I test this serializer in a Laravel project?
Mock Kiota’s `RequestInformation` in PHPUnit tests, inject the `TextSerializationWriter`, and verify serialization/deserialization. Test edge cases like empty strings, special characters, and encoding (e.g., ISO-8859-1). Use Laravel’s HTTP tests to simulate API responses.
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.
nqxcode/phpmorphy
boundwize/pyrameter
testo/facade
headercat/phpstan-extension-ide-helper
yosymfony/parser-utils
innmind/black-box
babenkoivan/elastic-migrations
babenkoivan/elastic-adapter
sandermuller/package-boost-php
sandermuller/boost-core
develia/commons
dmstr/symfony-system-resources-bundle
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
renatomarinho/laravel-page-speed
develia/geo-bundle
austinheap/laravel-database-encryption
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle