Restful Web Service

Hi guys,

I would like to make a restul web service with yii 2.0.

I read the restful guide but I have a problem.

I’ve created a new basic template application, then I made the changes wrote in restful guide:

  • created the folders controllers and models in basic/modules/v1 (for API versioning)

  • created the following new controller for test:

namespace app\controllers;

use yii\rest\ActiveController;

class UserController extends ActiveController


    public $modelClass = '';


Then changed the application config:

    'modules' => [

        'v1' => [

            'basePath' => '@app/modules/v1',



        'urlManager' => [

            'enablePrettyUrl' => true,

            'enableStrictParsing' => true,

            'showScriptName' => false,

            'rules' => [

                ['class' => 'yii\rest\UrlRule', 'controller' => ['v1/user']],



But the result of the GET request http://address/api/v1/user (from error.log) is:

File does not exist: /var/www/api/v1

Can anyone help me please?