Yii Framework Forum

Basic template vs new Yii 3.0 template

(Alexander Makarov) #1

As you now can check Yii 3.0 application template preview via How to get started with Yii 3.0 application please voice your opinion on it.

Which one you like best?

  • Yii 2.0 style basic template
  • Yii 3.0 style template

0 voters

Please explain your choice. Thanks!

(Muhammad Alantabli) #2

More Clean Architecture, KISS Principle.

(Arief Wijaya) #3

As long as the template keep MVC separation strongly, I think it’s Ok.

How to get started with Yii 3.0 application
(Alirz23) #4

yii3 basic app structure is confusing lot of people using yii are not composer experts or php experts, my only concern is it will make it difficult for beginners to get stared.

We need to attract more people to yii not push them away by introducing abstractions which are hard to grasp.

(Softark) #5

I agree with @alirz23.

The new yii-project-template looks too sophisticated to me. Isn’t it an overly designed layer that serves only to the formal beauty of the structure? yii-base-web, yii-base-cli and yii-base-api would be enough.

I understand that it might be solved by a good documentation, though.
I believe that once you’ve install the new template, you’ll get a standard directory structure with standard functionalities that we used to get from app-basic template.

(Stefano Mtangoo) #6

As others have said, It is a complicated structure. The major problem being, the sources folders are not clear as in Yii2. I would like to install template and start coding outright. Until that’s solved and made obvious, my vote goes to Yii2 template.

(Stefano Mtangoo) #7

Another thing that need to be clear is how the REST API fits in that specific template. In Yii2 I would just install "yiisoft/yii2-rest": "~1.0.0" and delete Views folder. But dunno how to deal with Yii3 template

(Alexander Makarov) #8

@evstevemd if you need both web and REST, require both packages in composer.json.

(Stefano Mtangoo) #9

I missed the composer require yiisoft/yii-base-api which does nicely what I wanted for rest API

(Alirz23) #10

what is funny in the poll is most of people voted for yii3 don’t even know about the actual problem

(Alexander Makarov) #11

I’m sure at least @Insolita understands it completely so I’d not be that sure others do not.

(Softark) #12

So we have to emphasize that the new yii 3 template “yii-project-template” is a kind of place holder for the actual templates: “yii-base-web”, “yii-base-cli” and “yii-base-api”. Ideally we should easily be able to select only the required functionalities through those 3 templates and other libraries.

(Shivcharan Panjeta) #13

I would like to keep 2.0 approach and only let composer be used for additional code not main app. Also index.php should be simpler.

(Tecnologiaterabyte) #14

My proposal basically would be to have a template, which would allow you to install as in Yii2 in a practical and simple way, usually the majority seeks to install the Application Web Template, which for me, the best proposal is @hiqsol with the base web skeleton and skeleton master, since it allows updating the base web skeleton without reinstalling it simply by updating and its installation was simple and intuitive with the basic configurations of any web application.

Hopefully we will have the DB layer working, since this will allow more people to relate and we can make corrections of other important packages, and so we can move faster.

On the other hand you can create another template, which of a clear example of how to use yii-base-api, yii-base-cli, so that we can all clearly understand what is the best way to work.

Sorry my bad english.

(Jiuly Rojas) #15

i agree with you @vanhelvzla

(Sreenadh) #16

I think the purpose of a template should be to bootstrap a new app with minimal effort.

This is what I got after running the command
composer create-project --prefer-dist --stability=dev yiisoft/yii-project-template myapp

With this, I’ve to create everything from scratch. For that we have Laravel.

We need a basic template same as like yii2.

(Tom) #17

I really like the idea of a “yii-base” template with “yii-base-web”, “yii-base-cli”, “yii-base-api” templates for each purpose. We currently tend to always use the yii2-advanced template because we usually need cli, a frontend and backend webapp - or even more than 2 web parts. So the ability to only add api/cli/web as needed for a product, but as many of each as you need within the product, seems powerful. It’s also very much in line with current application design views and will make Yii 3 future-proof for the next decade!

However I also wholeheartedly agree with everyone concerned about accessibility for new and novice users and the learning curve required. It was quite a struggle for us to get started with yii2 about 3 years ago and it was not for the faint-hearted. It’s also Yii’s greatest disadvantage to Laravel and others. So overcoming this should be part of the Yii 3 agenda, but not at the expense design quality based architecturally sound decisions when we have other ways of lowering the barrier to entry and making Yii3 easy to get started with.

So why not do something like this?

  1. Create the new Yii 3 template structure as proposed because it makes sense.
  2. Make sure adding each api/cli/web component can be done with a one-liner. So for example do not require a composer require foxy/foxy:^1.0.0 to get yii-base-web to work, just make foxy a dependency of yii-base-web
  3. Create a quick-start wizard on https://www.yiiframework.com/start. Ask the user what he/she needs for a new product and interactively generate the list of composer commands to copy/paste to the CLI (or even a downloadable bash/powershell script) depending on the checkboxes the user marked. For example:

The product I’ll be building:

  • Will have a website (= adds composer require yiisoft/yii-base-web)
  • Will have an API (= adds composer require yiisoft/yii-base-api)
  • Will have batch jobs (= adds composer require yiisoft/yii-base-cli)
  • Will be used from a command line interface (= adds composer require yiisoft/yii-base-cli)
  • Will have users that register and/or login (= adds a user module)
  • Will need role-based access control (= adds composer require yiisoft/yii-rbac)


[Start button]

(Alexander Makarov) #18

Good ideas. Thanks!

(Oleg) #19

It would be cool, if new Yii3 web template will have some basic CMS features to start, like Admin panel, menu editor, RBAC manager, logging module, modular structure etc, like Yii2 Starter Kit, which is really popular (but too complicated for beginners). Such “yii-base-cms” will gain new developers to use Yii for common tasks, like website rapid development.

(Alexander Makarov) #20

I don’t think it’s a good idea:

  1. Flexible CMS isn’t easy to implement and maintain.
  2. Not everything requires CMS.
  3. Not everything requires that kind of CMS.
  4. Template will be more complicated with it.