Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrii-hrechyn/auto-documentation
Auto Documentation is a library for generating API documentation for Laravel.
https://github.com/andrii-hrechyn/auto-documentation
documentaion laravel laravel10 openapi openapi3 redoc redocly
Last synced: about 1 month ago
JSON representation
Auto Documentation is a library for generating API documentation for Laravel.
- Host: GitHub
- URL: https://github.com/andrii-hrechyn/auto-documentation
- Owner: andrii-hrechyn
- License: mit
- Created: 2023-02-23T14:00:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-25T11:49:53.000Z (4 months ago)
- Last Synced: 2024-09-28T20:22:00.946Z (about 2 months ago)
- Topics: documentaion, laravel, laravel10, openapi, openapi3, redoc, redocly
- Language: PHP
- Homepage:
- Size: 278 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Auto Documentation
Auto Documentation is a library for generating API documentation for Laravel.
# What It Does
This package allows you to generate API documentation. Based on [OpenAPI 3](https://github.com/OAI/OpenAPI-Specification) and [Redoc](https://github.com/Redocly/redoc)Once installed you can do stuff like this:
```php
// Create documentation for path
Path::get('/your/api/{endpoint}', 'Your endpoint name')
->group('Some group')
->tag('Some tag') // or ->tags(['First tag', 'Second tag'])
->parameters([
PathParameter::make('endpoint')
->required()
->type(Type::string)
->example('myGoodEndpoint'),
])
->jsonRequest([
StringProperty::make('some_property_name')->required()
->description('You can add description for each property'),
BooleanProperty::make('one_more_property'),
])
->successfulResponse([
StringProperty::make('message')->example('Success response'),
])
->secure();// Or you can use existing schemas
Path::get('/your/api/endpoint', 'Your endpoint name')
->group('Some group')
->tag('Some tag') // or ->tags(['First tag', 'Second tag'])
->parameters([ExampleParameter::make()])
->jsonRequest(ExampleSchema::make())
->successfulResponse(ExampleSchema::make())
->secure();//Also you can do that for routes
Route::make('name.of.your.route', 'Example route')
->group('Some other group')
->tag('Other tag')
->requestBodyFromRequestClass() // Get request body from validation rules in request class
->successfulResponse(ExampleSchema::make())
->secure();
```## Installation
You can install the package via Composer:
```bash
composer require andrii-hrechyn/auto-documentation
```Then you can run command:
```bash
php artisan auto-doc:install
```
This command create folder ```docs``` in your root folder with some examples of documentation.
Also, this command will add autoload to your composer.json
```
...
"autoload": {
"psr-4": {
"App\\": "app/",
...
"Docs\\": "docs"
}
},
...
```
```docs``` folder contains all files related to documentation.
Folder structure:
```
├── Components
│ ├── Parameters
│ │ └── ExampleParameter.php
│ └── Schemas
│ ├── ExampleSchema.php
│ └── ExampleSubSchema.php
├── Paths
│ ├── testPaths.php
│ └── testRoute.php
└── info.php
``````info.php``` contains general information about API (info, servers, security, default security and external docs link)
## Usage
For generate documentation run command:
```bash
php artisan auto-doc:generate
```
This command take info.php file and all paths from ```docs``` folder and generate ```documentation.yaml``` in ```storage/app/auto-docs```## Configuration
...
## Testing
...
## License
This library is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Credits
- Developer: Andriy Hrechyn
- Email: [email protected]