There is no the best approach. Also there is a 4th option: admin module.
Which approach to use depends on:
are you developing an application alone or in a team;
how big is the application;
do you want to have fully separate backend/frontend or not (with different url types, login systems, etc.);
will you need to move backend to another server;
your personal taste of course
[*] I used it successfully in several small projects (frontend and backend are separated).
[*] I didn’t use it, but it should work well for small and medium projects (frontend and backend are separated).
[*] Nice approach for a team development and if you want to move backend to another server.
[*] (admin module) Probably the most popular approach for small projects (it can be also used for big projects of course, but I just can’t estimate it’s popularity in this case ). Backend is a part of a frontend (means backend and frontend use the same url manager, user application component, etc.). Very easy to install and use. Inside the admin module you put controllers to manage data (create, update, delete, etc.) + correponding views, and protected/controllers are just to list/view data.
I tend to use the 4th approach too, i’ve used it in small and large cases and in teams so its pretty flexible. I would say sub modules might be worth looking at if its a huge project (20 controllers+) but not needed as it just organises code a little better.
Andy, 4th Option: admin module. I’m sorry to ask you silly question but I’m not clear on it. What do you mean to have admin module, are you referring to a specific Yii Admin Extension or we can create a Module from gii -> Module Generator?