Application template


(Schmunk) #12

The question is, what is simpler? Just to have a website by default?
The possibility to not have that was brought up in another design discussion.

Several users wanted to be able to start with no assumptions made in advance and ie. just create an API with a CLI.

Adding the web-part to the project template should just be one command, in theory :slight_smile:

It would also be nice, if yii-demo was created from yii-project-template which is AFAIK not the case.


(Alexander Makarov) #13

It’s not the case because yii-project-template is currently outdated.


(Alexander Makarov) #14

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.


#15

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.


(Alexander Makarov) #16

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


(Schmunk) #17

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


(Schmunk) #18

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.


#19

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).


(Alexander Makarov) #20

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


(jomonjohnson) #21

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


(Alexander Makarov) #22

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.


(Lubosdz) #23
  • 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.


(Schmunk) #24

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.


(Schmunk) #25

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


(Alexander Makarov) #26

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


(Lubosdz) #27

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.


#28

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.


(Schmunk) #29

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


#30

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.


(Alexander Makarov) #31

The blog tutorial for Yii 1 was similar conceptually.