Hey guys,
I am looking to implement a RESTful controller. I have been following along with this tutorial : http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html.
However, I am trying to use a slightly different directory structure :
–Frontend
[indent]–api[/indent]
[indent][indent]–controllers[/indent][/indent]
[indent][indent][indent]–UserApiController.php[/indent][/indent][/indent]
[indent]–controllers[/indent]
[indent]–models[/indent]
[indent]–etc[/indent]
and I have the following code:
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
['class' => 'yii\rest\UrlRule', 'controller' => 'user'], // <---- I feel like this is what I should be changing, but I want to make sure I am doing this right.
],
]
I assume ‘user’ points to the controllers folder by default, can i say ‘frontend\api\controllers\userapi’? (the file is named UserApiController.php)
I appreciate any time spent reviewing this, I really hope I made sense. I will clarify further if needed.
Thanks