Skip to content

Commit da8c2cd

Browse files
Merge branch 'dev' into rb-42-change-default-encoding-options
2 parents 1ef83a9 + 864b534 commit da8c2cd

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

CHANGES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# API Response Builder for Laravel 5 #
22

3-
43
See [compatibility docs](docs/compatibility.md) for details about backward compatibility!
54

6-
75
## CHANGE LOG ##
86

97
* @dev
108
* [RB-42] Default value of `encoding_options` include `JSON_UNESCAPED_UNICODE` to prevent unicode escaping
9+
* [RB-41] Updated documentation
1110

1211
* v3.1.0 (2017-02-28)
1312
* [RB-38] Added `encoding_options` to control data-to-json conversion.
@@ -109,3 +108,4 @@ See [compatibility docs](docs/compatibility.md) for details about backward compa
109108

110109
* v1.0.0 (2016-04-11)
111110
* Initial public release
111+

docs/docs.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ Methods' arguments:
228228
* `$http_code` (**int**) valid HTTP return code (see `HttpResponse` class for useful constants),
229229
* `$lang_args` (**array**) array of arguments passed to `Lang::get()` while building `message`,
230230
* `$message` (**string**) custom message to be returned as part of error response (avoid, use error code mapping feature).
231+
* `$encoding_options` (**int**) data-to-json conversion options as [described in documentation of json_encode()](http://php.net/manual/en/function.json-encode.php). Pass `null` for default `ResponseBuilder::DEFAULT_ENCODING_OPTIONS` ([source](https://github.com/MarcinOrlowski/laravel-api-response-builder/blob/master/src/ResponseBuilder.php#L47)). See [configuration](https://github.com/MarcinOrlowski/laravel-api-response-builder/blob/master/config/response_builder.php#L106) key `encoding_options` too!
231232

232233
Most arguments of `success()` and `error()` methods are optional, with exception for `$api_code`
233234
for the latter. Helper methods arguments are partially optional - see signatures below for details.
@@ -253,8 +254,8 @@ See [W3 specs page](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) for
253254

254255
#### Reporting Success ####
255256

256-
success($data = null, $api_code = null, array $lang_args = [], $http_code = null);
257-
successWithCode($api_code = null, array $lang_args = [], $http_code = null);
257+
success($data=null, $api_code=null, array $lang_args=[], $http_code=null, $encoding_options=null);
258+
successWithCode($api_code=null, array $lang_args=[], $http_code=null);
258259
successWithHttpCode($http_code);
259260

260261
Usage restrictions:
@@ -263,11 +264,11 @@ Usage restrictions:
263264

264265
#### Reporting Error ####
265266

266-
error($api_code, $lang_args = [], $data = null, $http_code = HttpResponse::HTTP_BAD_REQUEST);
267-
errorWithData($api_code, $data, array $lang_args = []);
268-
errorWithDataAndHttpCode($api_code, $data, $http_code, array $lang_args = []);
269-
errorWithHttpCode($api_code, $http_code, $lang_args = []);
270-
errorWithMessage($api_code, $error_message, $http_code = HttpResponse::HTTP_BAD_REQUEST);
267+
error($api_code, $lang_args=[], $data=null, $http_code=HttpResponse::HTTP_BAD_REQUEST);
268+
errorWithData($api_code, $data, array $lang_args=[], $encoding_options=null);
269+
errorWithDataAndHttpCode($api_code, $data, $http_code, array $lang_args=[], $encoding_options=null);
270+
errorWithHttpCode($api_code, $http_code, $lang_args=[]);
271+
errorWithMessage($api_code, $error_message, $http_code=HttpResponse::HTTP_BAD_REQUEST);
271272

272273
Usage restrictions:
273274

0 commit comments

Comments
 (0)