捕梦者基础框架API接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1.6 KiB

home actionText actionLink features
true Get Started → /Getting-started {title OpenAPI specification} {details Compatible with the OpenAPI Specification version 3. formerly known as Swagger.}] [{title Use @Annotations} {details Write the documentation inside the php source files which helps to keep the documentation in sync.}] [{title Useful error messages} {details Enhanced errors messages with hints and context.}

Install with composer:

composer require zircote/swagger-php

Create a php file:

<?php
require("vendor/autoload.php");
$openapi = \OpenApi\scan('/path/to/project');
header('Content-Type: application/x-yaml');
echo $openapi->toYaml();

Add annotations to your php files.

/**
 * @OA\Info(title="My First API", version="0.1")
 */

/**
 * @OA\Get(
 *     path="/api/resource.json",
 *     @OA\Response(response="200", description="An example resource")
 * )
 */

And view and interact with your API using Swagger UI