Download the PHP package freedomcore/laravel-openapi without Composer
On this page you can find all versions of the php package freedomcore/laravel-openapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download freedomcore/laravel-openapi
More information about freedomcore/laravel-openapi
Files in freedomcore/laravel-openapi
Package laravel-openapi
Short Description OpenAPI documentation generator for Laravel
License MIT
Informations about the package laravel-openapi
Laravel OpenAPI
Simple to use OpenAPI 3 compatible documentation generator.
Also includes OpenAPI UI.
About
- OAS3 support
- Automatic generation (assuming relevant configuration option is turned on)
- Includes of OpenAPI UI
- Uses PHP 8 Attributes
Requirements
This package developed on Laravel 8.19.0
, but it might work on the previous releases.
All other requirements are inherited from the Laravel 8
.
PHP 8 is required for this package to work
Installation
Install package through composer
Publish configuration files and views
Edit the openapi.php
configuration file for your liking
What is included
Out of the box this package can work with FormRequest
, it is also able to generate valid code for the method parameters when they are included in query | path
, so there will be no duplicates
and in: ****
will also be assigned correctly.
Usage
FreedomCore\OpenAPI\Attributes\Controller
Controller attribute allows you to mark class as a Controller.
This will help generator to recognize classes and create appropriate tags for routes.
FreedomCore\OpenAPI\Attributes\Request\*
There are total of 5 types of requests currently supported by this package.
-
FreedomCore\OpenAPI\Attributes\Request\Delete
-
FreedomCore\OpenAPI\Attributes\Request\Get
-
FreedomCore\OpenAPI\Attributes\Request\Patch
-
FreedomCore\OpenAPI\Attributes\Request\Post
- FreedomCore\OpenAPI\Attributes\Request\Put
You dont have to use these Attributes unless you want to add description to the resource, possible request types will be inferred from Laravel routing system.
FreedomCore\OpenAPI\Attributes\Response\*
There are total of 18 types of responses currently supported by this package.
They do come with the correct response codes attached to them, so the only thing you have to do (or not) is add description.
This is the base class:
And this is the example of FreedomCore\OpenAPI\Attributes\Response\Ok
response:
Example User.php
Controller
And here is the WebUI look: