mdref.json config
[mdref/mdref-json_post] / json_post.md
1 # pecl/json_post
2
3 ## About:
4
5 JSON POST handler.
6
7 Parse JSON request bodies into `$_POST`.
8
9 ## What it does:
10
11 This tiny extension provides a PHP content type handler for JSON to PHP's form data parser.
12
13 If the `Content-Type` of an incoming request is `application/json` or `text/json`, the JSON contents of the request body will by parsed into `$_POST`.
14
15 ## Installation:
16
17 This extension is hosted at [PECL](http://pecl.php.net) and can be installed with [PEAR](http://pear.php.net)'s pecl command:
18
19 # pecl install json_post
20
21 ## Dependencies:
22
23 * ext/json
24
25 ## INI Directives:
26
27 json_post.flags = 1
28 : json_decode() flags
29 * JSON_OBJECT_AS_ARRAY = 1
30 * JSON_BIGINT_AS_STRING = 2
31 * JSON_OBJECT_AS_ARRAY|JSON_BIGINT_AS_STRING = 3
32 * JSON_INVALID_UTF8_IGNORE = 1048576 ; (PHP >= 7.2)
33 * JSON_INVALID_UTF8_SUBSTITUTE = 2097152 ; (PHP >= 7.2)
34 * JSON_THROW_ON_ERROR is ignored
35
36 json_post.onerror.response = 0
37 : Send a custom HTTP response status on failure, e.g.:
38 ; send `HTTP/1.1 400 Bad Request` on error
39 json_post.onerror.response = 400
40
41 json_post.onerror.warning = Off
42 : Raise `E_WARNING` on failure decoding JSON when enabled.
43
44 json_post.onerror.exit = Off
45 : Exit PHP without running the script on decoding failure when enabled.
46
47 ## Changelog:
48
49 0. v1.1.0
50 * Ignore JSON_THROW_ON_ERROR in `json_post.flags`.
51 * Add `json_post.onerror.response` INI setting.
52 * Add `json_post.onerror.warning` INI setting.
53 * Add `json_post.onerror.exit` INI setting.