Application template

The question is whatever we prefer plain simple templates vs package inheritance. For example, yii-base-web will magically add some routes and their implementation to the application. yii-base-cli will add some console commands etc. In order to remove/adjust these you’ll have to override some configs.

I can see already questions, how can I enable cli in in my base-web, or how can I enable web in my cli?
If its possible to make it “combined” … would be nice.

1 Like

That’s why I dislike current template :frowning: base-web is not a template, it is used by template.

Yeah, base-web, base-api and other bases are merely entrypoints.

I’d vote for keeping the project-template without any code (like it is atm), but build examples like yii2-app-basic or yii2-app-advanced from it.

We could move on with generator approach. Then we could have one template, which is almost empty by default, but could easily generate endpoints using command line (provided by separate package). Like vendor/bin/yiiapp web frontend generates web endpoint under fronted directory and vendor/bin/yiiapp rest api will generate REST API endpoint under api directory. It could be even extended to use community templates (vendor/bin/yiiapp rob006/fancy-web-template fronted).


Or we can revert to plain template approach such as yii-app-basic. Without any base packages or composition or generation (except gii).

what about symfony skelton,
can include required app templates as composer require dependencies?

1 Like

Yes. That is possible as well and that’s actually how current template is built. But it seems it leads to no good in our case because it seems to be very confusing.

  • By newcomers - most welcomed would be the simplest possible “Hello world” template - just quick setup, low learning curve.
  • By experienced devs more complex template would be most likely preferred - learning how to solve complex implementation issues (rbac, gii, multisite, design becakend/frontend, widgets, cron …).

The idea of template configurator is great, though may be hard to implement & maintain.

You should be able to use the project-template and create a basic-project-template from it and commit that again to another repo, which is effectively a fork.

Actually that task should be scriptable.

Actually that’s the idea of the yii-base(s).

For the purpose of demonstrating complex implementation, a demo would be more suitable than template.

1 Like

I am not sure what you mean by “demo” - will there be Yii3 demo online with github repo … ? If so, then yes, it would suffice. Actually it’s good idea - adding examples of complex implementations in a one place. One could clone fork git repo as a “new project” and also provide back PRs, if needed.
But there has never been any demo for Yii1 nor Yii2 by now so the concept is new to me.


yii-base(s) are intended to be used as composer dependencies (at least at this point). I’m proposing automated copy&paste to interactively generate application starter adapted to specific needs. You can always add another endpoint (like API) to your app, but after that it is all yours.

What do you want to adjust for these endpoints (by generation or config)?

1 Like

I want to work on them, like with yii2-app-advanced. The point its that if I need only frontend, console, and api, I need to remove unused parts from yii2-app-advanced and add missing ones. I after 6 months I need to add backend endpoint, I need to do that manually. With the generator approach, this could be automated - I could choose which endpoints want to use in the starter and add new in the future in the same way.

The blog tutorial for Yii 1 was similar conceptually.

Question is just one. My company and i use yii2-app-advanced with backend/frontend architecture always. How to implement same architecture with any of the new templates (web/api)?? Thanks

Используем yii2-app-advanced для проектов внутри компании, как реализовать архитектуру с backend/frontend на базе нового Yii3, возможно примеры есть уже ? Спасибо!

We don’t want to advertise it as “correct” way to structure your app. There are no examples yet but it will be possible and posted as a wiki article.

1 Like