lanser / laravel-data-openapi-generator
Generate OpenAPI specification from Laravel routes and Laravel Data objects.
Requires
- laravel/framework: ^8|^9|^10
- phpdocumentor/reflection-docblock: ^5.3
- spatie/invade: ^1.0
- spatie/laravel-data: ^3.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.15
- nunomaduro/larastan: ^2.5
- orchestra/testbench: ^7.8
- pestphp/pest: ^1.21
README
# OpenAPI Generator using Laravel Data Generate OpenAPI specification from Laravel routes and Laravel Data objects # Install ## Add composer repository In `composer.json` add this repository: ```json "repositories": [ { "type": "github", "url": "https://github.com/xolvionl/laravel-data-openapi-generator" } ], ``` ## Install `composer require xolvio/laravel-data-openapi-generator` # Optional ## Version Add a `app.version` config in `app.php` to set the version in the openapi specification: ```php 'version' => env('APP_VERSION', '1.0.0'), ``` ## Vite PWA config If using `vite-plugin-pwa`, make sure to exclude '/api/' routes from the serviceworker using this config: ```ts VitePWA({ workbox: { navigateFallbackDenylist: [ new RegExp('/api/.+'), ], }, }) ``` ## Vue page ```vue { "meta": { "public": true } } </template> <script lang="ts" setup> const url = `${import.meta.env.VITE_APP_URL}/api/openapi`; </script> ``` # Usage ## Config `php artisan vendor:publish --tag=openapi-generator-config` ## Generate `php artisan openapi:generate` ## View Swagger available at `APP_URL/api/openapi`#� �a�p�i�-�g�e�n�e�r�a�t�e�-�d�o�c�s� � �