Skip to content

Commit 22626ad

Browse files
Merge pull request #61 from RonasIT/readme-update
#-: update readme
2 parents 65ccbfd + 7a21422 commit 22626ad

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

readme.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
1-
# Laravel AutoDoc plugin
2-
3-
This plugin is designed to gather information and generate documentation about
4-
your Rest-Api while passing the tests. The principle of operation is based on
5-
the fact that the special Middleware installed on the Route for which you want
6-
to collect information that after the successful completion of all tests
7-
generated Swagger-file. In addition this plug-in is able to draw Swagger-template
8-
to display the generated documentation for a config.
1+
# Laravel Swagger plugin
2+
<p align="left">
3+
<a href="https://packagist.org/packages/ronasit/laravel-swagger"><img src="https://img.shields.io/packagist/dt/ronasit/laravel-swagger" alt="Total Downloads"></a>
4+
<a href="https://packagist.org/packages/ronasit/laravel-swagger"><img src="https://img.shields.io/packagist/v/ronasit/laravel-swagger" alt="Latest Stable Version"></a>
5+
<a href="https://packagist.org/packages/ronasit/laravel-swagger"><img src="https://img.shields.io/packagist/l/ronasit/laravel-swagger" alt="License"></a>
6+
</p>
97

8+
## Introduction
9+
This plugin is designed to generate documentation about your Rest API while
10+
passing the tests. Special Middleware installed on the Route generates
11+
Swagger-file after the successful completion of all tests. In addition, this
12+
plugin is able to draw Swagger-template to display the generated documentation for a config.
1013
## Installation
1114

1215
### Composer
13-
1. `composer require ronasit/laravel-swagger`
16+
1. Require this package with composer using the following command: `composer require ronasit/laravel-swagger`
1417

1518
### Laravel
16-
1. If you're on Laravel 5.5 or later the package will be auto-discovered.
17-
Otherwise you will need to manually configure it in your config/app.php.
19+
1. For Laravel 5.5 or later the package will be auto-discovered.
20+
For older versions add the `AutoDocServiceProvider` to the providers array in config/app.php as follow:
1821
```php
1922
'providers' => [
2023
// ...
2124
RonasIT\Support\AutoDoc\AutoDocServiceProvider::class,
2225
],
2326
```
24-
2. run `php artisan vendor:publish`
25-
27+
2. To publish configuration file run `php artisan vendor:publish`
2628
### Plugin
2729
1. Add middleware **\RonasIT\Support\AutoDoc\Http\Middleware\AutoDocMiddleware::class** to *Http/Kernel.php*.
2830
1. Use **\RonasIT\Support\AutoDoc\Tests\AutoDocTestCaseTrait** in your TestCase in *tests/TestCase.php*
29-
1. In *config/auto-doc.php* you can specify enabling of plugin, info of your project,
30-
some defaults descriptions and route for rendering of documentation.
31-
1. In *.env* file you should add following lines
31+
1. In *config/auto-doc.php* you can specify enabling of plugin, project info,
32+
some default descriptions and routes for documentation rendering.
33+
1. In *.env* file you should add following lines:
3234
`
3335
LOCAL_DATA_COLLECTOR_PROD_PATH=/example-folder/documentation.json
3436
LOCAL_DATA_COLLECTOR_TEMP_PATH=/tmp/documentation.json
3537
`
36-
1. Configure documentation saving, using one of the next way:
38+
1. Configure documentation saving using one of the next ways:
3739
- Add `SwaggerExtension` to the `<extensions>` block of your `phpunit.xml`. Please note that this way will be removed after updating PHPUnit up to 10 version (https://github.com/sebastianbergmann/phpunit/issues/4676)
3840
```
3941
<extensions>
@@ -48,9 +50,9 @@ to display the generated documentation for a config.
4850
- Call `php artisan swagger:push-documentation` console command after the `tests` stage in your CI/CD configuration
4951

5052
## Usages
51-
For correct working of plugin you have to dispose all the validation rules in the rules() method of class YourRequest,
53+
For correct working of plugin you have to dispose all the validation rules in the rules() method of `YourRequest` class,
5254
which must be connected to the controller via DependencyInjection. In annotation of custom request you can specify
53-
summary and description of this request. Plugin will take validation rules from your request and use it as description
55+
summary and description. Plugin will take validation rules from your request and use it as description
5456
of input parameter.
5557

5658
### Example
@@ -104,13 +106,13 @@ to display the generated documentation for a config.
104106

105107
- **@summary** - short description of request
106108
- **@description** - Implementation Notes
107-
- **@_204** - Custom description of code of response. You can specify any code as you want.
108-
- **@some_field** - Description of this field from the rules method
109+
- **@_204** - Custom description of response code. You can specify any code as you want.
110+
- **@some_field** - Description of the field from the rules method
109111

110112
If you do not create a class Request, the summary, Implementation Notes and parameters will be empty.
111113
Plugin will collect codes and examples of responses only.
112114

113-
If you do not create annotations to request summary will generate automatically from Name of Request.
115+
If you do not create annotations to request summary it will generate automatically from Name of Request.
114116
For example request **UpdateUserDataRequest** will have summary **Update user data request**.
115117

116118
If you do not create annotations for descriptions of codes it will be generated automatically the following priorities:
@@ -119,8 +121,15 @@ to display the generated documentation for a config.
119121
3. Descriptions from **Symfony\Component\HttpFoundation\Response::$statusTexts**
120122

121123
Note about configs:
122-
- *auto-doc.route* - it's a route where will be located generated documentation
123-
- *auto-doc.basePath* - it's a route where located root of your api
124+
- *auto-doc.route* - it's a route for generated documentation
125+
- *auto-doc.basePath* - it's a root of your api root
124126

125127
Also you can specify way to collect documentation by creating your custom data collector class.
128+
## Contributing
129+
130+
Thank you for considering contributing to Laravel Swagger plugin! The contribution guide can be found in the [Contributing guide](CONTRIBUTING.md).
131+
132+
## License
133+
134+
Laravel Swagger plugin is open-sourced software licensed under the [MIT license](LICENSE).
126135

0 commit comments

Comments
 (0)