PHP code example of avtehnik / service-doc

1. Go to this page and download the library: Download avtehnik/service-doc 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/ */

    

avtehnik / service-doc example snippets


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

/**
 * @ServiceDoc\PathItem(
 *     microservice="payment",
 *     path="/wallet-prices",
 *     method="get",
 *     @ServiceDoc\Tag(
 *          name="user",
 *     )
 * )
 * @param $destination_code
 * @param $source_code
 *
 * @return
 */

    class DocumentationController extends Controller
    {
        public function actions()
        {
            return [
                'servicedoc' => [
                    'class' => 'ServiceDoc\YiiServiceDocAction',
                    'scanDir' => [
                        Yii::getAlias('@common/components')
                    ],
                ],
            ];
        }
    }
    


ger = \ServiceDoc\scan(__DIR__);
header('Content-type: application/json; charset=utf-8');
echo $swagger->toJson();