symfony/json-streamer
Symfony JsonStreamer provides powerful methods to read and write data structures from and into JSON streams, enabling memory-efficient processing of large JSON documents without loading everything at once.
/export endpoints).json_decode() in background jobs (e.g., ProcessLargeFileJob).Adopt When:
json_encode()/json_decode().Look Elsewhere When:
msgpack or ubjson instead).For Executives:
"This package lets us scale our data-heavy features without hitting memory limits. For example, our /export API currently crashes when users request large datasets—this solves that by streaming JSON incrementally, reducing server costs and improving reliability. It’s a drop-in upgrade for Laravel/Symfony apps, with zero risk since it’s maintained by the Symfony core team. Early tests show 50% lower memory usage for payloads >100MB, which directly impacts our SLA for data-intensive workflows."
For Engineering:
*"Symfony’s JsonStreamer replaces json_encode()/json_decode() with a memory-safe, streaming alternative. Key wins:
StreamedResponse to send chunked JSON without buffering (e.g., for paginated exports).php artisan import:json).JsonStreamer in a Laravel service, and replace synchronous calls. Benchmark against your current solution—expect no timeouts for files >1GB and consistent performance under load."*For Developers: *"Need to handle huge JSON files or stream responses? This package lets you:
// Before (crashes for large files)
$data = json_decode(file_get_contents('huge.json'), true);
// After (memory-safe)
$streamer = new JsonStreamer();
foreach ($streamer->read('huge.json') as $item) {
process($item); // No OOM!
}
Works with Laravel’s StreamedResponse, queues, and Symfony’s serializer. Start with a PoC on a high-memory endpoint—expect zero buffering and faster processing."*
How can I help you explore Laravel packages today?