simdjson

Provides faster json decoding through simdjson bindings for PHP


Provides faster json decoding through simdjson bindings for PHP (Single Instruction, Multiple Data)

License: Apache 2.0

Latest releases

Version Release Download
4.0.0 2022-10-19 simdjson-4.0.0.tgz
3.0.0 2022-10-17 simdjson-3.0.0.tgz
2.1.0 2022-10-14 simdjson-2.1.0.tgz
2.0.5 2022-10-12 simdjson-2.0.5.tgz
2.0.4 2022-10-01 simdjson-2.0.4.tgz
Show all releases

Changelog

Version Message
4.0.0 * Make the `SIMDJSON_ERR_*` constants case-sensitive in all PHP versions.
(The code it was based on was missing the flag needed to mark constants as case sensitive before PHP 8)
* Fix a bug that prevented using JSON pointer in `simdjson_key_count`, `simdjson_key_exists`, and `simdjson_key_value` with a leading slash https://www.rfc-editor.org/rfc/rfc6901.html.

This bug was introduced when working around test failures following a change in json pointer validation in the underlying C simdjson library.
* "" in a JSON pointer continues to refer to the entire document.
* "/" in a JSON pointer now properly refers to the key that is the empty string.
* Continue to allow the non-standard omission of the leading "/" for compatibility with earlier PECL releases. This may be deprecated in a subsequent release.
3.0.0 * Add SimdJsonValueError. In php 8.0+, it extends ValueError, and it extends Error in older php versions.
This provides an API similar to the JSON module, which started throwing ValueError for invalid depths in php 8.0.
* Throw SimdJsonValueError instead of emitting notices if $depth is too small or too large in all simdjson PHP functions.
simdjson_is_valid(), simdjson_key_count() and simdjson_key_exists() now have non-null return types.
* Throw a SimdJsonException in simdjson_key_exists on error conditions such as invalid json, to be consistent with other simdjson PHP functions.
* Add an optional boolean `$throw_if_uncountable = false` to simdjson_key_count.
When this is overridden to be true, simdjson_key_count will throw a SimdJsonException if the JSON pointer refers to a value that exists but is neither an array nor an object instead of returning 0.
* Rename the parameter $assoc to $associative in simdjson_decode and simdjson_key_value, to match naming practices used in json_decode()
2.1.0 * Allow out of range 64-bit values in JSON integer syntax and allow floating point values outside of the max/min finite floating point values (i.e. parsing to +/- infinity).

This allows simdjson_decode() to be used as a replacement for json_decode() in more use cases.
* Return the correct value in simdjson_key_count() for JSON pointers to arrays/objects exceeding size 0xFFFFFF.
Previously, this would be limited to returning at most 0xFFFFFF(16777215).
* Throw 'SimdJsonException extends RuntimeException' instead of RuntimeException.
* Set the error code from simdjson as SimdJsonException->getCode()
* Expose error_code constants from simdjson as `SIMDJSON_ERR_$ERRCODENAME`
2.0.5 * Reuse PHP's 1-byte and 0-byte interned strings in simdjson_decode, reducing memory usage for those strings. (e.g. for the key/value in '{"x":""}')
* Return correct count in simdjson_key_count. Properly return counts larger than 0xFFFFFF instead of returning 0xFFFFFF.
2.0.4 * Add `-fvisibility=hidden` to compiler options to reduce compiled extension size by avoiding exporting symbols by default.
* If the requested json parsing $depth is excessively large when reallocating larger buffers for the C simdjson parser,
then internally use a smaller $depth that would behave identically with lower memory usage. (#66)
* Update simdjson to properly reject surrogate pairs with an invalid low surrogate. (https://en.wikipedia.org/wiki/UTF-16)
Show complete changelog