How to get started with Yii 3.0 application

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!

But if I want to do some cron task in my REST app, counld yii cli tools included be better?

Yes. Then you move it from require-dev to require.

Hey.
Made the installation of the application as described here.
There is a problem with yii\db\mysql\Schema.
Attempting to submit a login form gave an error

  ` 2018-11-23 20:31:36 [127.0.0.1][-][u1ogsen5ulpefd5vosmfa4eg47][error]
    yii\di\exceptions\NotFoundException] yii\di\exceptions\NotFoundException:
    No definition for "yii\db\mysql\Schema" found in
    vendor/yiisoft/di/src/AbstractContainer.php:166`

The vendor is missing yii\db\mysql\Schema.
How to get the missing files?

Yes, because DB-related functionality isn’t ready yet. Yii 3.0 is work in progress…

1 Like

Will it be enough just to copy these files from yii2?