There are already dependencies to yii and its parts.
I am not sure what kind of dependencies you mean?
In any case, there should be examplery code for console, web and maybe rest api.
Maybe the web and restapi could be done with a Gii like generator. E.g. you want to add a blog, easy - goto app generator.
One issue you linked is about the user expecting a index.php, well no idea there. I think create-project should make something which usable from start, gives a better feeling specially for first time users. But could also be “yii init” script doing that.
The other issue is about libraries, using vue or vanilla js or angular - those differ drasticaly.
It would be nice if this is in a separate package, and not bundled.
If I make a console app, I dont need it, same for API. And if I want make web app I can use it then.
Vanilla JS should be default. And a external package which can enhance that.
Voting for make it simpler, multiple templates are tedious to mantain, and I dont see any advantage. I had say, make Gii generator for that.
One key feature of (advanced at least) - deployability / maintainability. I added an API “section” (@api) to advanced in under an hour for example that pulls in all my core models in @common and just requires 1-2 controllers to build out a complete functional API. Could it be easier? Sure, but having a consistent interface for deployment and updates (checkout -> composer install -> ./yii migrate) should not be overlooked. The trouble is not starting a project - the trouble is not cratering it with mistakes after it is up and running.
The advantage to the current templates is that they have a consistent, maintained, explicit structure which is predictable enough that I can write Ansible scripts around it, for example. Just having a “demo” is not the same thing as having a deployable application I can hand to devops and not have to spend the next two weeks creating scaffolding from scratch…
The utility of the current templates should not be overlooked - they are actually fairly simple from that perspective vs. some other approaches I have seen, which actually makes the templates quite useful. If there is confusion due to the “complexity”, the answer is probably better docs or how-tos, not removing the feature.
Sure. Demo is just an example, it’s not a template that we’re going to ship with alpha version.
That’s all fine, but really I’m not sure if anyone would be happy doing it this way. Most people are used to doing it the “simplified” way, and I don’t just mean Yii users, I’m talking about Laravel, Symfony, Cake, etc.
Now when you create a new controller and want to render a view, you will probably not remember the render code and have to copy and paste it from another controller.
Yes, we can create out own render function that wraps all that logic up, but really we should not have to do this. I think many users will be put off by this approach.
This thing? I was going to move it to yii-web package.
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
It would also be nice, if
yii-demo was created from
yii-project-template which is AFAIK not the case.
It’s not the case because
yii-project-template is currently outdated.
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.
That’s why I dislike current template
base-web is not a template, it is used by template.
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-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?
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.
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