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
Laminas Serializer

Laminas Serializer Laravel Package

laminas/laminas-serializer

Laminas serializer library providing adapters for PHP serialize, JSON, igbinary, and more, plus a configurable factory for serializing and deserializing data in Laminas and Mezzio applications.

View on GitHub
Deep Wiki
Context7

Serialize and deserialize PHP structures to a variety of representations

Frequently asked questions about Laminas Serializer
Does laminas/laminas-serializer work with Laravel?
Yes. It is framework-agnostic and integrates through Laminas\Serializer\Adapter\AdapterInterface, which you can bind in Laravel’s service container. Laravel’s container implements PSR-11, so the package’s container-based resolution works without a Laravel-specific bridge. You will need to wire configuration and adapter selection yourself because the package does not ship a Laravel service provider.
How do I install laminas/laminas-serializer in a Laravel app?
Run composer require laminas/laminas-serializer and confirm your PHP version satisfies the package constraints. In Laravel, bind Laminas\Serializer\Adapter\AdapterInterface in a service provider or resolve the adapter directly from the container. If you are upgrading from 3.x, change your Composer constraint to ^4.0 because ^3.3 will not pull 4.0.0.
Which serialization adapters does laminas/laminas-serializer provide?
The library includes adapters for PHP serialize, JSON, igbinary, and additional representations. In v4 the JSON adapter is a thin wrapper over PHP’s native json_encode() and json_decode(), because laminas-json was removed as a dependency. XML and PHP-serialize adapters are unchanged from earlier versions, so benchmark them separately if they are on hot paths.
Is laminas/laminas-serializer compatible with Laravel 10 and 11?
It is not tied to a specific Laravel release; compatibility depends on PHP and PSR/Container v2.0.0+ support. Laravel 10 and 11 containers satisfy that contract, so the package can be used there. Check the package’s composer.json for PHP constraints before pinning it in older Laravel applications.
How do I configure a serializer adapter in Laravel?
Create the adapter with its options array, such as JSON flags or depth settings, and bind it to Laminas\Serializer\Adapter\AdapterInterface in a service provider. The package’s configurable factory can also be used to select adapters by name in Laminas and Mezzio-style configuration. In Laravel, keep this configuration in config/serializer.php or a dedicated service provider and avoid the removed PhpSerialize option on v4.
What breaking changes are in laminas-serializer 4.0?
Version 4.0.0 removes the deprecated PhpSerialize option, drops laminas-json as a dependency, and deletes the unused Module class. The JSON adapter now uses native json_encode() and json_decode(), so code that caught Laminas\Json exceptions must migrate to native JsonException handling. Internals are more strictly typed, which may surface previously silent coercions as errors. Review the official v4 migration guide referenced by PR #101 before upgrading.
How do I migrate from laminas-serializer 3.x to 4.0 in Laravel?
Audit your Laravel config arrays and service providers for the removed PhpSerialize option, and remove or replace those settings. Search first-party code for direct Laminas\Json\* references and exception catches, then switch them to native JSON functions and JsonException. Update your Composer constraint from ^3.3 to ^4.0 and re-run tests that assert exact JSON output, flags, depth, and unicode escaping. Use the official v4 migration guide as the primary upgrade reference.
Does the v4 JSON adapter match Laravel's native json_encode behavior?
The v4 JSON adapter is a thin wrapper over PHP’s native json_encode() and json_decode(), so output and performance should be near-identical to Laravel’s native JSON handling. Behavioral parity still depends on the adapter options and flags you pass, so test depth, unicode escaping, and error cases explicitly. This native backend removes the previous laminas-json wrapper layer and reduces a prior latency objection for hot paths.
How do I test serialization with laminas/laminas-serializer in Laravel?
Use PHPUnit to assert round-trip serialization and deserialization for each adapter you enable. For JSON, compare exact output against expected strings and test JsonException paths for invalid data or depth failures. Also test your Laravel service provider binding so the correct adapter and options are resolved from the container in production-like configuration.
Is laminas/laminas-serializer production-ready for Laravel, and what alternatives exist?
Yes, it is production-ready for framework-agnostic serialization, but keep an eye on dependency footprint because laminas-servicemanager v4.0+ remains required even though laminas-json is gone. Benchmark XML and PHP-serialize adapters on critical paths; the JSON adapter is now close to native performance. Alternatives include Laravel’s native json_encode() and json_decode() for simple JSON, symfony/serializer for normalization-heavy work, and jms/serializer for annotation-driven mappings.
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.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core