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/documenting.md
+42-7Lines changed: 42 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,9 +94,9 @@ They will be included in the generated documentation text and example requests.
94
94
95
95
**Result:**
96
96
97
-

97
+

98
98
99
-

99
+

100
100
101
101
### Example parameters
102
102
For each parameter in your request, this package will generate a random value to be used in the example requests. If you'd like to specify an example value, you can do so by adding `Example: your-example` to the end of your description. For instance:
@@ -114,11 +114,11 @@ For each parameter in your request, this package will generate a random value to
114
114
115
115
You can also exclude a particular parameter from the generated examples (for all languages) by annotating it with `No-example`. For instance:
116
116
```php
117
-
/**
118
-
* @queryParam location_id required The id of the location. Example: 1
119
-
* @queryParam user_id required The id of the user. No-example
120
-
* @queryParam page required The page number. Example: 4
121
-
*/
117
+
/**
118
+
* @queryParam location_id required The id of the location. Example: 1
119
+
* @queryParam user_id required The id of the user. No-example
120
+
* @queryParam page required The page number. Example: 4
121
+
*/
122
122
```
123
123
Outputs:
124
124
```bash
@@ -151,6 +151,41 @@ public function createPost(MyRequest $request)
151
151
## Indicating authentication status
152
152
You can use the `@authenticated` annotation on a method to indicate if the endpoint is authenticated. A "Requires authentication" badge will be added to that route in the generated documentation.
153
153
154
+
Just like `@group` annotation, you can also specify an `@authenticated` on a single method to override the authenticated status defined at the controller level.
155
+
156
+
```php
157
+
/**
158
+
* @authenticated
159
+
*
160
+
* APIs for managing users
161
+
*/
162
+
class UserController extends Controller
163
+
{
164
+
165
+
/**
166
+
* Create a user
167
+
*
168
+
* [Insert optional longer description of the API endpoint here.]
169
+
*
170
+
*/
171
+
public function createUser()
172
+
{
173
+
174
+
}
175
+
176
+
/**
177
+
* @group Account management
178
+
*
179
+
*/
180
+
public function changePassword()
181
+
{
182
+
183
+
}
184
+
}
185
+
```
186
+
187
+
Now all the methods under this controller will have "Requires authentication" badge enabled.
188
+
154
189
## Providing an example response
155
190
You can provide an example response for a route. This will be displayed in the examples section. There are several ways of doing this.
0 commit comments