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.
serialize() — relevant for APIs, caching, and storage layers.serialize() payloads to structured JSON).laminas-json dependency in favor of PHP's native JSON functions — fewer transitive dependencies to audit, patch, and license-review. A small but real win for supply-chain/security reviews.var_export(), unserialize()) with modern formats for gradual modernization.composer update.PhpSerialize deprecated option, whether we rely on the removed Module class for Laminas MVC wiring, and whether any code type-checks against changed serializer signatures.serialize() to safer, structured formats (avoids object-injection risks).laminas-json entirely in favor of native JSON functions.jms/serializer or msgpack/msgpack.symfony/serializer or spatie/array-to-object for simpler cases.igbinary or custom C extensions.Module class or the deprecated PhpSerialize option and cannot absorb a BC break this quarter — stay on 3.3.x until the migration is scheduled. v4 removes the unused Module class, so any reliance on module-level autoloading/config must be replaced with explicit configuration or container wiring.PhpSerialize deprecated option removed — audit for its use; behavior changes for anyone still passing it.Module class removed — affects Laminas MVC users who relied on implicit module registration; DI wiring now must be explicit (Laravel container bindings unaffected in principle, but verify)."This package standardizes how data moves across our PHP systems — APIs, caches, internal services. Instead of scattered json_encode() calls or risky serialize() usage, we get a maintained, adapter-based tool that reduces tech debt, supports PHP 8.4+, and lets us swap formats without rewriting call sites.
Version 4.0 has just shipped as a major release, which means two things: (1) it's a maintenance win — it drops the laminas-json dependency and uses PHP's native JSON, shrinking our dependency surface; and (2) it's a planned upgrade, not a routine patch — there are documented breaking changes (a removed deprecated option, a removed module class, stricter typing) plus an official migration guide.
Ask: a scoped engineering slot to run the migration guide and regression suite. Cost: low (open source, BSD-3, no license spend). Risk: low-to-moderate — the breaks are documented and bounded, and we can stay on 3.3.x if the slot slips. ROI: fewer dependencies to audit, fewer serialization bugs, and a supported upgrade path instead of drifting onto an unmaintained version."
"laminas-serializer 4.0.0 gives us:
serialize() behind a consistent interface.laminas-json removed, native JSON functions used instead (PR #80).BC breaks to handle before upgrading:
PhpSerialize option removed (PR #94) — grep for it.Module class removed (PR #88) — if you relied on Laminas MVC module wiring, configure services explicitly now.Migration path:
Module usage.serialize() where possible, and configure defaults via the factory.Trade-offs:
jms/serializer if needed.Example:
// Before: scattered logic
$json = json_encode($user);
// After: centralized, testable, swappable
$serializer = new \Laminas\Serializer\Adapter\JsonAdapter();
$json = $serializer->serialize($user);
```*
How can I help you explore Laravel packages today?