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.
json_stream API without forcing every environment to compile a PECL extension.ext-json_stream and losing deploy targets, or (b) pulling a full userland streaming parser like halaxa/json-machine. This polyfill sits in between: it lets a dependency declare ext-json_stream as a soft requirement and still resolve on stock PHP.ext-json_stream, and you want Composer to resolve on environments without the extension.Look elsewhere when:
ext-json_stream (or just use json_decode with sane payload limits) and skip the dependency entirely.halaxa/json-machine, salsify/json-streaming-parser) have years of field use, real test suites, and active maintenance; a 0-star polyfill does not.One line: A small, MIT-licensed compatibility shim that lets us use streaming JSON parsing on platforms where we can't install the native PHP extension — unblocking large-payload features without a platform migration.
To executives: It removes a deployment blocker. Today, "parse a 400MB JSON export without exhausting memory" either requires us to control the runtime image or to rewrite the feature. This shim buys us the option to ship on Vapor, shared hosting, and on-prem installs from the same codebase. Cost is one dependency, no license fee, and the exit path is trivial — delete it the day we standardize on the native extension.
To engineering: Treat it as an adapter, not a foundation. Wrap it behind our own small parser interface so we can swap in ext-json_stream or a mature streaming parser later without touching call sites. Pin the version exactly, add it to the dependency-risk list, and benchmark it — a pure-PHP parser will be an order of magnitude slower than the C extension, so the worker/memory sizing we assume in staging must be re-measured in production. Do not let it silently become the only parser we test against; CI must exercise the native-extension path too, or we will ship bugs that only appear where the extension exists.
Honest caveat to include: zero stars, zero dependents, single maintainer. The right posture is "cheap, reversible enabler with a named owner and a removal plan," not "strategic infrastructure."
How can I help you explore Laravel packages today?