yiisoft / yii-base-web

Home Page:https://www.yiiframework.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add default configs / config cleanup

schmunk42 opened this issue · comments

What steps will reproduce the problem?

Try to install this package in yii-project-template

What is the expected result?

Ideally no manual config editing needed, default config should be merged by composer-config-plugin

What do you get instead?

I have to add several config options:

    ServerRequestFactoryInterface::class => Psr17Factory::class,
    UriFactoryInterface::class => Psr17Factory::class,
    UploadedFileFactoryInterface::class => Psr17Factory::class,
    StreamFactoryInterface::class => Psr17Factory::class,
    ResponseFactoryInterface::class => Psr17Factory::class,
    UrlMatcherInterface::class => Reference::to(RouterInterface::class),
    UrlGeneratorInterface::class => Reference::to(RouterInterface::class),
    EmitterInterface::class => SapiEmitter::class,

in addition to the above I need to add

AppRouterFactory.php
Controller.php
MiddlewareDispatcherFactory.php

which look project dependent, I am not sure how to proceed with these.

Additional info

Q A
Version master
PHP version 7.4
Operating system Debian

This is a more general question which config options are needed for the web-base, since I am not very experienced with Yii 3.x at the moment.

Moreover I think we can remove several other defaults from this packages, such as db or console.

I'd like to get some advice if this is the right path.

Related: #17

I think we need to drop some layers from project template and keep it simple and in one-package that becomes your application. Same as in Yii 2.

There are actually no layers in project-template, you have to choose which layers your app will have, eg. web, api, cli, vue...

The web-base should have sane "auto-configured" defaults for the services which it needs, or?

The config-plugin is perfect for this.

Well, yes and no. Initial idea was proved to be very confusing: https://forum.yiiframework.com/t/basic-template-vs-new-yii-3-0-template/123978/38

That's why, while it has some advantages such as choosing layers, a simple template could work better.

yii-project-template and yii-demo do not exclude each other.

You can create a simple template from the project template, that's the idea. You do not have to.
You are not forced to use the web-base, but you can if you like.


There are no yii-base-* used in yii-demo.

yii-project-template and yii-demo do not exclude each other.

Yes. Demo is for internal needs. A playground. While project template is a thing to start a new project with Yii 3.

You can create a simple template from the project template, that's the idea. You do not have to.
You are not forced to use the web-base, but you can if you like.

The issue is that it seems majority didn't grasp the concept of web-base at all. That's why I'm worried about making it default way to start with Yii application.

The issue is that it seems majority didn't grasp the concept of web-base at all. That's why I'm worried about making it default way to start with Yii application.

I understand the concerns ... but there were also other voices, I'll work on that in the next weeks.
If you want a web-template people can start with, let's create a separate one, eg. yii-web-app-template ... whatever. But let's keep yii-project-template non opinionated and open for all cases.

I don't want to maintain multiple templates.

Let's try if we can create/maintain the yii-web-app-template with a script.

OK. Anything I can help you with?

I'll raise my voice ;)