You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs.md
+57-22Lines changed: 57 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,9 +25,9 @@
25
25
26
26
## Response structure ##
27
27
28
-
Predictability, simplicity and no special-case is the key of the `ResponseBuilder` design. I wanted to make my life easier not
29
-
only when I develop the API itself, but also when I'd try to use it i.e. in mobile applications, therefore all responses created
30
-
by this package **guarantee** consistent JSON structure by design.
28
+
Predictability, simplicity and no special-case is the key of the `ResponseBuilder` design. I wanted to make my life
29
+
easier not only when I develop the API itself, but also when I'd try to use it i.e. in mobile applications,
30
+
therefore all responses created by this package **guarantee** consistent JSON structure by design.
31
31
32
32
By default response always contain at least the following elements:
33
33
@@ -45,18 +45,23 @@
45
45
46
46
*`success` (**boolean**) indicates API method failure or success,
47
47
*`code` (**int**) is your own return code (usually used when returning error message or other failure),
48
-
*`locale` (**string**) represents locale used for returned error message (obtained automatically via `\App::getLocale()`). This helps processing the response if you support multiple languages,
49
-
*`message` (**string**) human readable message that is ready to display and explains human readable explanation of the `code` value,
50
-
*`data` (**object**|**array**|**null**) if you return any additional data with your reply, it would end here. If no extra data is needed, that key still be present in the response with `null` value.
48
+
*`locale` (**string**) represents locale used for returned error message (obtained automatically via
49
+
`\App::getLocale()`). This helps processing the response if you support multiple languages,
50
+
*`message` (**string**) human readable message that is ready to display and explains human readable explanation
51
+
of the `code` value,
52
+
*`data` (**object**|**array**|**null**) if you return any additional data with your reply, it would end here.
53
+
If no extra data is needed, that key still be present in the response with `null` value.
51
54
52
-
**NOTE:** If you need to return other/different elements in the above structure (not in your `data`), see [Manipulating Response Object](#manipulating-response-object) chapter for detailed information about how to achieve this.
55
+
**NOTE:** If you need to return other/different elements in the above structure (not in your `data`),
56
+
see [Manipulating Response Object](#manipulating-response-object) chapter for detailed information about how
57
+
to achieve this.
53
58
54
59
----
55
60
56
61
## Usage examples ##
57
62
58
-
The following examples assume `ResponseBuilder` is properly installed and available to your Laravel application. Installation
59
-
steps are described in details in further chapters, if help is needed.
63
+
The following examples assume `ResponseBuilder` is properly installed and available to your Laravel application.
64
+
Installation steps are described in details in further chapters, if help is needed.
60
65
61
66
#### Success ####
62
67
@@ -438,30 +443,34 @@ $data = [
438
443
439
444
Minimum requirements:
440
445
441
-
* PHP 7.2+
442
-
* Laravel 6.*
443
-
444
-
The following PHP extensions are optional but strongly recommended:
445
-
446
-
* iconv
447
-
* mb_string
446
+
* PHP 7.2+ with [json extension](https://www.php.net/manual/en/book.json.php),
447
+
* Laravel v6.x (see [legacy](docs/legacy.md) for Laravel 5.x support).
448
448
449
449
----
450
450
451
451
## Installation and Configuration ##
452
452
453
453
To install `ResponseBuilder` all you need to do is to open your shell/cmd and do:
Copy file name to clipboardExpand all lines: docs/exceptions.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,9 +142,10 @@ public const VALIDATION_EXCEPTION = ...;
142
142
`ResponseBuilder`'s handler which usually lead to one (or another) handler not being executed
143
143
at all.
144
144
145
-
For example if your API delegates OAuth2 related tasks to popular [lucadegasperi/oauth2-server-laravel](https://packagist.org/packages/lucadegasperi/oauth2-server-laravel)
146
-
package, then you must **NOT** use its `OAuthExceptionHandlerMiddleware` class and ensure it is not set,
147
-
by inspecting `app/Kernel.php` file and ensuring the following line (if present) is removed or commented out:
145
+
For example if your API delegates OAuth2 related tasks to popular
146
+
[lucadegasperi/oauth2-server-laravel](https://packagist.org/packages/lucadegasperi/oauth2-server-laravel) package, then you
147
+
must **NOT** use its `OAuthExceptionHandlerMiddleware` class and ensure it is not set, by inspecting `app/Kernel.php` file
148
+
and ensuring the following line (if present) is removed or commented out:
0 commit comments