/yii2-rest-extras

Extra actions, controller and helpers for rest in yii2

Primary LanguagePHPOtherNOASSERTION

Tecnocen Yii2 Bootstrap Year Calendar

Latest Stable Version Total Downloads Latest Unstable Version License

Extra utilities for REST in yii2

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist "faryshta/yii2-rest-extras:*"

or add

"faryshta/yii2-rest-extras": "*"

to the require section of your composer.json file.

Usage

Options Action

The options action class faryshta\rest\actions\Options returns the same headers as yii\rest\ActionOptions and it also returns a body with a deconstructed description of the model.

This action is meant to be used in the actions() method on a controller

use faryshta\rest\actions\Options;

public function actions()
{
    return [
        'options' => [
            'class' => Options::className(),
            'modelClas' => $this->modelClass,
            'extraData' => function ($model) {
                // array with the extra data you want to return.
            },
        ]
    ]
}

License

The BSD License (BSD). Please see License File for more information.