Skip to content

Commit f4fae44

Browse files
committed
Update README.md
1 parent 4ee8830 commit f4fae44

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

readme.md renamed to README.md

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ passing PHPUnit tests.
2828

2929
## Installation
3030

31-
1. Install the package using the following command: `composer require ronasit/laravel-swagger`
31+
1. Install the package using the following command:
32+
33+
```sh
34+
composer require ronasit/laravel-swagger
35+
```
3236

3337
> ***Note***
3438
>
@@ -55,7 +59,7 @@ php artisan vendor:publish --provider=RonasIT\\AutoDoc\\AutoDocServiceProvider
5559
return Application::configure(basePath: dirname(__DIR__))
5660
->withMiddleware(function (Middleware $middleware) {
5761
$middleware->use([
58-
...
62+
//...
5963
\RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware::class,
6064
]);
6165
});
@@ -65,29 +69,23 @@ php artisan vendor:publish --provider=RonasIT\\AutoDoc\\AutoDocServiceProvider
6569

6670
5. Configure documentation saving using one of the next ways:
6771
- Add `SwaggerExtension` to the `<extensions>` block of your `phpunit.xml`.
68-
**Please note that this way will be removed after updating**
69-
**PHPUnit up to 10 version (https://github.com/sebastianbergmann/phpunit/issues/4676)**
7072

7173
```xml
7274
<phpunit>
75+
//...
7376
<extensions>
7477
<bootstrap class="RonasIT\AutoDoc\Support\PHPUnit\Extensions\SwaggerExtension"/>
7578
</extensions>
76-
<testsuites>
77-
<testsuite name="Feature">
78-
<directory suffix="Test.php">./tests/Feature</directory>
79-
</testsuite>
80-
</testsuites>
8179
</phpunit>
8280
```
8381
- Call `php artisan swagger:push-documentation` console command after
84-
the `tests` stage in your CI/CD configuration
82+
the `tests` stage.
8583

8684
## Usage
8785

8886
### Basic usage
8987

90-
1. Create request class:
88+
1. Create a request class:
9189

9290
```php
9391
<?php
@@ -144,7 +142,7 @@ php artisan vendor:publish --provider=RonasIT\\AutoDoc\\AutoDocServiceProvider
144142
> Plugin will take validation rules from the request class and generate fields description
145143
> of input parameter.
146144

147-
2. Create a controller and a method for your route:
145+
1. Implement request handling in the corresponding controller class:
148146

149147
```php
150148
<?php
@@ -166,10 +164,10 @@ php artisan vendor:publish --provider=RonasIT\\AutoDoc\\AutoDocServiceProvider
166164

167165
> ***Note***
168166
>
169-
> Dependency injection of request class is optional but if it not presents,
170-
> the "Parameters" block in the API documentation will be empty.
167+
> Dependency injection of the request class is optional, but if it isn't present,
168+
> the 'Parameters' block in the API documentation will be empty.
171169

172-
3. Create test for API endpoint:
170+
3. Create a test for the API endpoint:
173171

174172
```php
175173
public function testUpdate()
@@ -184,15 +182,15 @@ php artisan vendor:publish --provider=RonasIT\\AutoDoc\\AutoDocServiceProvider
184182
}
185183
```
186184

187-
4. Run tests
188-
5. Go to route defined in the `auto-doc.route` config
185+
4. Run the tests
186+
5. Go to the route which is defined in the `auto-doc.route` config
189187
6. Profit!
190188

191189
![img.png](resources/assets/images/img.png)
192190

193191
### Annotations
194192

195-
You can use the following annotations in your request classes to customize documentation of your API endpoints:
193+
You can use the following annotations in the corresponding request class to customize documentation of the API endpoint:
196194

197195
- **@summary** - short description of request
198196
- **@description** - implementation notes
@@ -204,11 +202,6 @@ You can use the following annotations in your request classes to customize docum
204202
>
205203
> If you do not use request class, the summary and description and parameters will be empty.
206204

207-
### Configs
208-
209-
- `auto-doc.route` - route for generated documentation
210-
- `auto-doc.basePath` - root of your API
211-
212205
### Custom driver
213206

214207
You can specify the way to collect and view documentation by creating your own custom driver.
@@ -218,8 +211,8 @@ You can find example of drivers [here](https://github.com/RonasIT/laravel-swagge
218211
### Viewing OpenAPI documentation
219212

220213
As of version 2.2, the package includes the ability to switch between OpenAPI documentation
221-
viewers. To access different viewers, modify the `documentation_viewer` configuration.
222-
This change is reflected immediately, without the need to rebuild the documentation file.
214+
viewers. To access different viewers, modify the `documentation_viewer` configuration or set the viewer using
215+
the `SWAGGER_SPEC_VIEWER` env. This change is reflected immediately, without the need to rebuild the documentation file.
223216

224217
### Merging additional documentations
225218

@@ -238,3 +231,4 @@ can be found in the [Contributing guide](CONTRIBUTING.md).
238231
## License
239232

240233
Laravel Swagger plugin is open-sourced software licensed under the [MIT license](LICENSE).
234+

0 commit comments

Comments
 (0)