Extra utilities for REST in yii2
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.
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.
},
]
]
}
The BSD License (BSD). Please see License File for more information.