'api', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'api\controllers', 'bootstrap' => ['log'], 'modules' => [], 'components' => [ 'cartLogic' => ['class' => 'api\logic\CartLogic'], 'orderLogic' => ['class' => 'api\logic\OrderLogic'], 'userLogic' => ['class' => 'api\logic\UserLogic'], 'address' => ['class' => 'api\logic\AddressLogic'], 'request' => [ 'parsers' => [ 'application/json' => 'yii\web\JsonParser', ], 'csrfParam' => '_csrf-api', ], 'session' => [ // this is the name of the session cookie used for login on the app 'name' => 'api', ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'user' => [ 'identityClass' => 'common\models\User', 'enableAutoLogin' => true, 'identityCookie' => ['name' => '_identity-api', 'httpOnly' => true], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => [ ['class' => 'yii\rest\UrlRule', 'controller' => 'goods', 'pluralize' => false], ['class' => 'yii\rest\UrlRule', 'controller' => 'address', 'pluralize' => false], ['class' => 'yii\rest\UrlRule', 'controller' => 'cart'], ['class' => 'yii\rest\UrlRule', 'controller' => 'order'], ['class' => 'yii\rest\UrlRule', 'controller' => 'user', 'pluralize' => false, 'extraPatterns' => [ 'GET token' => 'token' ] ], [ 'class' => 'yii\rest\UrlRule', 'controller' => 'admin', 'extraPatterns' => [ 'GET menu' => 'menu', 'GET create' => 'create' ] ], [ 'class' => 'yii\rest\UrlRule', 'controller' => 'site', 'extraPatterns' => [ 'GET index' => 'index', ] ], ], ], ], 'params' => $params, ];