Why don't you use the app-basic template?

Merry Xmas and a Happy New Year in advance, my dear friends!

Reading the various posts in the forum, I wondered so many times why the poster wanted to use the app-advanced template, while the app-basic template looks quite appropriate for his/her current project. Sometimes it looks to me that he/she is only making things complicated and tough by adopting the app-advanced template, especially when he/she is going to deploy both the front-end and the back-end apps to a shared hosting service. It doesn’t make sense.

There seems to be too many people with relatively less skill and less resource who try to use the app-advanced template only to lay an unnecessary burden to themselves.

I think we have to clear up some misunderstandings about the app-basic and the app-advanced templates.

1. The app-basic is only for the front-end.

They seem to have a misunderstanding that the app-basic can not have administrative pages, thinking that we need to use the app-advanced when we need some administrative sections.

But it’s not true, of course.

By constructing an appropriate RBAC structure, it’s fairly easy to have the administrative pages that can only be accessed by the administrators of the system along with the front-end pages for the ordinary users.

We may also have a separated administrative module for the administrators in the app-basic template.

2. The app-advanced can easily be deployed to a shared hosting service.

I have to admit it is possible to use the app-advanced template for a shared hosting environment. The document also describes how to do it.

But the modification of the app-advanced template for a shared hosting service is not very simple and easy. IMO it’s so tricky and twisted that no one with a common sense would not like to try. And it’s less efficient than the app-basic for a shared hosting.

I’d like to hear what you think about it, my dear friends. :)

Good topic. I’d love to hear about it as well.

Basic or advanced really makes no difference if you write your own admin area and code your own stuff.

I have found it better to ignore

or

I generally follow the

.

That way if I have to change an application from laravel to Yii2, or cakephp 3.X, it is so much easier.

I also find it so much easier to write regular sql and stay away from active record on complex queries.

Though I do like the query builder in both Yii2 and laravel.

Like




$dogs = (new \yii\db\Query())

                ->from('dc_dogs')

                ->where(['adopted' => 0])

                ->orderBy('sex ASC')

                ->addOrderBy('lastedit DESC')

                ->limit($rowsperpage)->offset($offset)

                ->all();



Hi Guys,

I was expecting exact topic to discuss.

As a Yii Developer, I am very comfortable and convenient that the basic-app is best and easiest way to implement any scalable web apps.

Till now I have used Yii 1.x and 2.x for building large scale applications to small web apps and even for building Mobile API’s.

My vote is for yii2-basic!

I accept yii2-advanced has many features, but why we should complicate ourself? unless there is a need and the situation matches to go with advanced!

I agree this is an important issue far to many users go for app-advanced when they can simply use app-basic, I don’t exactly know what the reason is, I figured it had to do with the size of the app maybe they working with large project. As it turns out @softark is right many users just use it to have an admin site as well as front site and they think app-advanced is the right way to do it, they can simply get away with a module or even with RBAC as @softark mentioned above.

Also another thing I have noticed many of users using app-advanced and have no clue how to deploy it be it shared hosting or even a ec2 instance and a lot of them don’t even know what init scripts are.

I think we should highlight this somewhere or perhaps create a docs page maybe.

https://github.com/yiisoft/yii2-app/issues Most probably we’ll have only one template in Yii 2.1.

http://www.yiiframework.com/forum/index.php/topic/74050-yii2-which-version-choose-basic-or-advanced/page__pid__309031#entry309031

Jacmoe had already posted almost the same opinion on it long before my post.

When I was making this choice, I knew I wasn’t on shared hosting, I needed a backend and frontend and liked that in the advanced app, the user authentication was already there instead of being hard coded demo/demo, admin/admin with the need to build or copy an authentication structure. Our server was managed by my mentor who let out an audible groan when he saw that I had uploaded the advanced app to our test site. Then I got the message about using a module for the backend, and RBAC all within the basic app.

I believe there are some versions of the basic app that include user authentication. Failing that, the authentication from the advanced template can be made to work in the original basic app.

The difference between the app-basic and the app-advanced:

yii2-app-advanced guide > Comparison

The difference boils down to 3 features, and 1 limitation:

[list=1]

[*]Front- and back-end apps

[*]Ready to use User model

[*]User signup and password restore

[*]Requires 2-host configuration (which should be in the comparison table 8) )

[/list]

Front- and back-end apps

The 1st one can easily be accomplished in the app-basic by making use of module.

The problem lies in the next 2 features. The less experienced the developer is, the more attractive they look to him/her.

Ready to use User model

We definitely need User model, but with a different spec from the one that the template supplies. We usually need to create different User model project by project according to its business requirements.

Do you need the template to do it for you? I always do it for myself using Gii.

User signup and password restore

The same goes much more for this feature. It’s too specific as a template feature. We might as well call it an example or a demo.

IMO these 2 features should not have been included in the app-advanced.

Hi samdark. Can you please briefly describe the main advantages of this new template over the basic/advanced ones? Could you explain why you chosed structure you’ve chosen? For example

  • Is the bin folder necessary?
  • Why is there another folder "src" for the common folders?
  • Why is config out of src?
  • Is it able to handle more apps? Like can I run web, rest api, admin and forum? 4 totally different apps with common models and db.
  • Is there gonna be an init script and environments folders like in the advanced template?
  • Will it work only with Yii 2.1?
  • etc

Thank you

It’s less complicated than advanced one and will be a bit more stuffed with features than basic one.

  • bin isn’t necessary but it gives you more order similar to what’s common in composer packages.

  • src is there to separate main app sources from everything else: configs, webroot, runtime etc.

  • It can’t handle multiple apps out of the box but you’re free to add more webroots and configs as you’d like.

  • No init script but environments (not like in advanced template).

  • Yes, it will be 2.1 only.

I have always used the basic-app and just borrowed the User model from the advanced. We are running a massive system, with multiple modules using the basic one and we’re very happy with it. :slight_smile:

Thanks for your reply. When released, will be there any examples how to manage more apps using more webroots and configs, because I can’t image now. Let’s say I’ll add new webroot folder like the public is, then set the webhosting properly, but what about the rest? All the src code - controllers, models, common models, etc. Should there be something like ‘app1-src’, ‘app2-src’?

Would I be still able to update to 2.1 with the basic and advanced template?

Yes. You should be able to use advanced with 2.1 with some adjustments.