PHP code example of digit-soft / laravel-swagger-generator
1. Go to this page and download the library: Download digit-soft/laravel-swagger-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
digit-soft / laravel-swagger-generator example snippets
namespace App\Models;
use OA;
/**
* Test model class
*
* @OA\Property("id",type="integer",description="Primary key")
*
* @property string $name String name
*/
class TestModel {}
namespace App\Components\Annotations\Swagger;
use OA\DescriptionExtender;
use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Annotations\Annotation\{Attribute, Attributes};
/**
* Describes needed permission
* @Annotation
* @Attributes({
* @Attribute("value",type="string"),
* })
* @package App\Components\Annotations\Swagger
*/
class Permission extends DescriptionExtender
{
/**
* @inheritdoc
*/
public function __toString()
{
return '**Permission:** `' . $this->value . '`';
}
}
use App\Components\Annotations\Swagger as SWA;
/**
* Controller method PHPDoc
*
* @OA\ResponseClass("App\User",description="User model response")
* @SWA\Permission("articles.can-update")
*
* @param Request $request
* @return \Illuminate\Http\JsonResponse
*/