joelwurtz/json-stream-polyfill
A polyfill bringing JSON streaming support to older PHP versions, so large JSON payloads can be encoded and decoded incrementally without loading the whole document into memory. Drop-in compatibility for projects unable to upgrade PHP.
Architecture fit
json_stream extension, meaning it is designed as a transparent shim over JsonStream\Reader / JsonStream\Writer-style APIs rather than a new abstraction. Architecturally this is a compatibility layer, not a parser library — value is realized only if the codebase (or a dependency) already targets the extension API.Integration feasibility
composer require joelwurtz/json-stream-polyfill is low-friction; no compilation, no PECL, no CI image changes. This is the main selling point versus requiring ext-json_stream on every developer machine and CI runner.Technical risk
json_decode on large documents while appearing to be a drop-in fix.PHP_INT_MAX, duplicate keys, depth limits, invalid UTF-8, BOM handling, trailing data, exception classes/hierarchy, and option flags passed to reader/writer constructors.Key questions
json_stream extension API does the polyfill target, and how completely (methods, options, exceptions)?json_decode?ext-json the only hard requirement?class_exists check, Composer provide/replace, or manual wiring?Stack fit
JsonStreamFactory) that returns either the native classes or the polyfilled ones, bound in a service provider so call sites never reference the package namespace directly.json_decode on realistically sized bodies is almost certainly faster than a PHP tokenizer.Migration path
json_decode/json_encode call sites wholesale. Introduce the abstraction first, ship it with the native extension (or existing code path) as the default, and register the polyfill only as a fallback.Compatibility
ext-json_stream is installed in some environments and not others (dev laptop vs. production container). The resolution logic must be deterministic across the fleet, otherwise you get environment-specific behavior — the single most common failure mode for this class of package.composer.json and commit a lockfile; do not use a floating constraint on a 0-star single-maintainer package.require the extension in its own composer.json (which would defeat the purpose) and does not replace it in a way that masks a genuinely missing extension.Sequencing
json_decode on representative payloads (throughput + peak memory).Maintenance
Support
Scaling
json_decode depends on document size and memory limits, not on the API.Failure modes
Ramp-up
json_decode replacement.How can I help you explore Laravel packages today?