Creating a REST API for Yii2-basic-template

I am trying to create a Rest API (BACKEND) for Yii2 basic template, to be used by AngularJS (FRONTEND).

I tried to use the Directory Structure below, but got lost.


  • web

  • config

  • controllers

  • models

  • views

  • vendors

  • api

    –+ config

    –+ modules

    ----+ v1

    ------+ controllers



Please can you give a sample Directory Structure of the API, and the contents

Should it be REST only? In that case go for Microframework. Check it, its in the guide. It gives you flexibility you seem to need.

If its part of bigger Yii app then I suggest you make it a nested module, that is: