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: README.md
+29-4Lines changed: 29 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,19 +14,31 @@ Automatically generate your API documentation from your existing Laravel/Lumen/[
14
14
> Note: this is the documentation for version 3, which changes significantly from version 2. if you're on v2, you can check out its documentation [here](https://github.com/mpociot/laravel-apidoc-generator/blob/2.x/README.md). We strongly recommend you upgrade, though, as v3 is more robust and fixes a lot of the problems with v2.
15
15
16
16
## Installation
17
-
> Note: version 3.x requires PHP 7 and Laravel 5.5 or higher.
17
+
> Note: PHP 7 and Laravel 5.5 or higher are required.
- Copy the config file from `vendor/mpociot/laravel-apidoc-generator/config/apidoc.php` to your project as `config/apidoc.php`. Then add to your `bootstrap/app.php`:
37
+
```php
38
+
$app->configure('apidoc');
39
+
```
40
+
41
+
30
42
## Usage
31
43
Before you can generate your documentation, you'll need to configure a few things in your `config/apidoc.php`.
32
44
-`output`
@@ -38,6 +50,9 @@ Set this option to true if you want a Postman collection to be generated along w
38
50
-`router`
39
51
The router to use when processing the route (can be Laravel or Dingo. Defaults to **Laravel**)
40
52
53
+
-`logo`
54
+
You can specify your custom logo to be used on the generated documentation. Set the `logo` option to an absolute path pointing to your logo file.
55
+
41
56
-`routes`
42
57
This is where you specify what rules documentation should be generated for. You specify routes to be parsed by defining conditions that the routes should meet and rules that should be applied when generating documentation. These conditions and rules are specified in groups, allowing you to apply different rules to different routes.
43
58
@@ -174,7 +189,7 @@ class UserController extends Controller
174
189
175
190
To specify a list of valid parameters your API route accepts, use the `@bodyParam` and `@queryParam` annotations.
176
191
- The `@bodyParam` annotation takes the name of the parameter, its type, an optional "required" label, and then its description.
177
-
- The `@queryParam` annotation (coming soon!) takes the name of the parameter, an optional "required" label, and then its description
192
+
- The `@queryParam` annotation takes the name of the parameter, an optional "required" label, and then its description
178
193
179
194
180
195
```php
@@ -189,6 +204,16 @@ public function createPost()
189
204
{
190
205
// ...
191
206
}
207
+
208
+
/**
209
+
* @queryParam sort Field to sort by
210
+
* @queryParam page The page number to return
211
+
* @queryParam fields required The fields to include
212
+
*/
213
+
public function listPosts()
214
+
{
215
+
// ...
216
+
}
192
217
```
193
218
194
219
They will be included in the generated documentation text and example requests.
@@ -274,7 +299,7 @@ If you don't specify an example response using any of the above means, this pack
274
299
- By default, response calls are only made for GET routes, but you can configure this. Set the `methods` key to an array of methods or '*' to mean all methods. Leave it as an empty array to turn off response calls for that route group.
275
300
- Parameters in URLs (example: `/users/{user}`, `/orders/{id?}`) will be replaced with '1' by default. You can configure this, however.Put the parameter names (including curly braces and question marks) as the keys and their replacements as the values in the `bindings` key.
276
301
- You can configure environment variables (this is useful so you can prevent external services like notifications from being triggered). By default the APP_ENV is set to 'documentation'. You can add more variables in the `env` key.
277
-
- You can also configure what headers, query parameters and body parameters should be sent when making the request (the `headers`, `query`, and `body` keys respectively).
302
+
-By default, the package will generate dummy values for your documented body and query parameters and send in the request. You can configure what headers and additional query and parameters should be sent when making the request (the `headers`, `query`, and `body` keys respectively).
0 commit comments