PHP code example of tobion / openapi-symfony-routing

1. Go to this page and download the library: Download tobion/openapi-symfony-routing 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/ */

    

tobion / openapi-symfony-routing example snippets


use OpenApi\Annotations as OA;

/**
 * @OA\OpenApi(
 *     @OA\Info(title="My API", version="1.0")
 * )
 */
class MyController
{
    /**
     * @OA\Get(
     *     path="/foobar",
     *     @OA\Response(response="200", description="Success")
     * )
     */
    public function __invoke()
    {
    }
}

use OpenApi\Annotations as OA;

class MyController
{
    /**
     * @OA\Get(
     *     path="/foobar",
     *     operationId="my-name",
     *     @OA\Response(response="200", description="Success")
     * )
     */
    public function __invoke()
    {
    }
}

use OpenApi\Annotations as OA;

class MyController
{
    /**
     * @OA\Get(
     *     path="/foobar",
     *     x={"format-suffix": {
     *         "enabled": true,
     *         "pattern": "json|xml"
     *     }},
     *     @OA\Response(response="200", description="Success")
     * )
     */
    public function __invoke()
    {
    }
}

use OpenApi\Annotations as OA;

class MyController
{
    /**
     * @OA\Get(
     *     path="/foobar",
     *     x={"priority": 10},
     *     @OA\Response(response="200", description="Success")
     * )
     */
    public function __invoke()
    {
    }
}