@@ -115,6 +115,28 @@ typedef uint8_t simdjson_php_error_code;
115115
116116/* NOTE: Callers should check if len is greater than 4GB - simdjson will always return a non zero error code for those */
117117
118+ /**
119+ * Parses the given string into a return code, using the default singleton parser.
120+ *
121+ * This must be called after simdjson's request initialization phase and before simdjson's request shutdown phase.
122+ * (e.g. PECLs should not use this during module or request initialization/shutdown)
123+ */
124+ PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_parse_default (const char * json , size_t len , zval * return_value , bool associative , size_t depth );
125+
126+ /**
127+ * Checks if the given JSON is valid, using the default singleton parser.
128+ * Returns 0 if it is valid.
129+ */
130+ PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_validate_default (const char * json , size_t len , size_t depth );
131+
132+ /**
133+ * Returns or creates the singleton parser used internally by simdjson (e.g. for the `php_simdjson_*_default()` methods).
134+ * (Thread-local in ZTS builds of PHP)
135+ *
136+ * Callers must NOT free this.
137+ */
138+ PHP_SIMDJSON_API struct simdjson_php_parser * php_simdjson_get_default_singleton_parser (void );
139+
118140/* FIXME add php_simdjson_get_default_singleton_parser api */
119141/* FIXME add php_simdjson_decode_with_default_singleton_parser(return_value, json, len, bool associative) */
120142
@@ -142,16 +164,9 @@ PHP_SIMDJSON_API struct simdjson_php_parser* php_simdjson_create_parser(void);
142164 */
143165PHP_SIMDJSON_API void php_simdjson_free_parser (struct simdjson_php_parser * parser );
144166/**
145- * Returns true if the given json string is valid
167+ * Returns 0 if the given json string is valid
146168 */
147- PHP_SIMDJSON_API bool php_simdjson_is_valid (struct simdjson_php_parser * parser , const char * json , size_t len , size_t depth );
148- /**
149- * Parses the given string into a return code, using the default singleton parser.
150- *
151- * This must be called after simdjson's request initialization phase and before simdjson's request shutdown phase.
152- * (e.g. PECLs should not use this during module or request initialization/shutdown)
153- */
154- PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_parse_default (const char * json , size_t len , zval * return_value , bool associative , size_t depth );
169+ PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_validate (struct simdjson_php_parser * parser , const char * json , size_t len , size_t depth );
155170/**
156171 * Parses the given string into a return code.
157172 *
0 commit comments