Skip to content

Commit 8f2c363

Browse files
committed
Update documentation
1 parent 92226ed commit 8f2c363

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,31 @@ Automatically generate your API documentation from your existing Laravel/Lumen/[
1414
> 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.
1515
1616
## 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.
1818
1919
```sh
2020
$ composer require mpociot/laravel-apidoc-generator:dev-master
2121
```
2222

23-
Then publish the config file by running:
23+
### Laravel
24+
Publish the config file by running:
2425

2526
```bash
2627
php artisan vendor:publish --provider=Mpociot\ApiDoc\ApiDocGeneratorServiceProvider --tag=config
2728
```
2829
This will create an `apidoc.php` file in your `config` folder.
2930

31+
### Lumen
32+
- Register the service provider in your `bootstrap/app.php`:
33+
```php
34+
$app->register(\Mpociot\ApiDoc\ApiDocGeneratorServiceProvider::class);
35+
```
36+
- 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+
3042
## Usage
3143
Before you can generate your documentation, you'll need to configure a few things in your `config/apidoc.php`.
3244
- `output`
@@ -38,6 +50,9 @@ Set this option to true if you want a Postman collection to be generated along w
3850
- `router`
3951
The router to use when processing the route (can be Laravel or Dingo. Defaults to **Laravel**)
4052

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+
4156
- `routes`
4257
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.
4358

@@ -174,7 +189,7 @@ class UserController extends Controller
174189

175190
To specify a list of valid parameters your API route accepts, use the `@bodyParam` and `@queryParam` annotations.
176191
- 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
178193

179194

180195
```php
@@ -189,6 +204,16 @@ public function createPost()
189204
{
190205
// ...
191206
}
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+
}
192217
```
193218

194219
They will be included in the generated documentation text and example requests.

0 commit comments

Comments
 (0)