PHP code example of chemezov / yii2-rest-api-doc

1. Go to this page and download the library: Download chemezov/yii2-rest-api-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/ */

    

chemezov / yii2-rest-api-doc example snippets




namespace app\controllers;

/**
 * Rest Title: Example Controller title.
 * Rest Description: Your controller description.
 * Rest Model: app\models\Document.
 */
class ExampleController extends \yii\rest\ActiveController
{

    /**
     * Rest Title: Your endpoint title.
     * Rest Description: Your endpoint description.
     * Rest Fields: ['field1', 'field2'].
     * Rest Filters: ['filter1', 'filter2'].
     * Rest Expand: ['expandRelation1', 'expandRelation2'].
     */
    public function actionTest()
    {
        return ['field1', 'field2'];
    }
}