How to get started with Yii 3.0 application

The main logic seems to reside in “yii-base-web” which is required in the composer.json of this template.

Yes, that’s the idea.

For now template installs web part as default but that may be changed.

1 Like

So if I want to customize the provided controllers, models & views (like SiteController or User) I need to go into vendor/ dir and edit them there, right?

I don’t like the idea of editing files in vendor, this is plain out wrong imo

Of course, no. You can add your own files.

1 Like

Most of the user files are under the “src” directory.
You can see the directory structure of “yii-base-web” here.

“yii-base-web” itself is a template.

3 Likes

Lucky I read this comment first.

I am afraid changes introduced in yii3 template will only push people away from the framework and community at large, and will confuse new comers, you will see people creating a mishmash of structures.

I remember when I first started yii it was the ease of building applications, a sensible directory structure was in place and lot of the code was already provided out of the box which made it super easy building apps.

perhaps we can have 3 different template but projects created from these templates must contain the files and directory structure.

2 Likes

for those who have composer asset plugin installed, I think --no-plugins should be added, ideally it should be disabled in composer.json.

edit well, that will also disable composer-config-plugin and the app will not work.

@alirz23 that’s likely to happen. That’s why Basic template vs new Yii 3.0 template

1 Like

If I follow the steps above, I get an empty repo cloned without any dependencies installed…

$ composer create-project --prefer-dist --stability=dev yiisoft/yii-project-template myapp1
Installing yiisoft/yii-project-template (dev-master 5a515dfc28e36f36d54a283c83da7f987c25a4dc)
  - Installing yiisoft/yii-project-template (dev-master master): Loading from cache
Created project in myapp1
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

Please see the update installation instructions https://github.com/yiisoft/yii-project-template#installation

Installing api does not generate vendor/bin/yii. Is that missing by design?

Yes. REST doesn’t need command line.

what about ./yii serve or gii console commands? It’s not hard to replace them with PHP server or use Gii UI instead of Gii console (and I doubt if many people preferred them over web) but what about them since we can’t have Web either?

It depends on your application. These are both development tools so could be put into require-dev section of composer.json. But you can have queue consumers or utility command you want in production as well. In this case you need to put console dependency into require.

You mean putting console app as dev dependency?

If there’s nothing to execute at production server then yes, absolutely.

1 Like

Got it. Thanks!