amphp/serialization
AMPHP serialization tools for IPC and storage in PHP. Provides a Serializer interface with JSON, native PHP serialize/unserialize, and passthrough implementations, plus optional payload compression via a wrapping serializer.
amphp/byte-stream, amphp/parallel, or custom IPC layers. Example:
$serializer = new CompressingSerializer(new NativeSerializer());
$payload = $serializer->serialize(['task' => $closure, 'data' => $resource]);
Illuminate\Bus\Queueable).Illuminate\Cache\Repository).#[Override] conflicts).NativeSerializer relies on PHP’s unserialize(), which is unsafe for untrusted data. No built-in safeguards (e.g., whitelisting, sandboxing).#[Override] may conflict with Laravel’s attributes (e.g., #[Cacheable]). No PHP 8.x support confirmed, risking serialization failures during upgrades.SerializationException for unsupported types).@mathroc) has no Laravel experience, limiting future support.CompressingSerializer) may not benefit small payloads (e.g., API responses) and adds CPU overhead.json_encode, Redis::compress(), serialize) or existing packages (e.g., spatie/array-to-object)?NativeSerializer be isolated from untrusted data (e.g., user input in IPC)? Are there whitelists or validation layers?#[Override] work with Laravel’s attributes (e.g., #[Cacheable])? If not, what’s the upgrade cost to support them?SerializationException be caught and retried in async contexts (e.g., queue workers, cache)?JsonSerializer)?json_encode, serialize) or existing packages (e.g., spatie/laravel-data, nesbot/carbon) achieve the same goals with lower risk?amphp/byte-stream, amphp/parallel). Example use cases:
Illuminate\Bus\Queueable payload serialization.Illuminate\Cache\Repository hooks or drivers.JsonSerializer is redundant with Laravel’s json_encode.EloquentSerializer).CompressingSerializer + NativeSerializer.Illuminate\Bus\PendingDispatch).EloquentSerializer).JsonSerializer on failure).SerializationException for monitoring and alerting.amphp/byte-stream, amphp/parallel, and fiber-based code.#[Override] conflicts).NativeSerializer.json_encode + gzip).CompressingSerializer.SerializationException.EloquentSerializer) if needed.How can I help you explore Laravel packages today?