Yii Framework Forum

How to get started with Yii 3.0 application

(Alexander Makarov) #41

Yes but check composer.json as well.

(slo-nik) #42

did not understand what to check in the composer?

(Alexander Makarov) #43

require section.

(slo-nik) #44

in vendor/yiisoft/yii-base-web/composer.json?
at removal dependences will be deleted?
so that package dependencies are not affected?

(slo-nik) #45

Migrations do not work?
When I try to make a migration, I get an error.

Yii Migration Tool (based on Yii v3.0.0-dev)

Error: Can not instantiate array (

But, if put the file with the finished migration into /src/migrations, then everything works


(Alexander Makarov) #46

Yes, whole DB layer isn’t working.

(slo-nik) #47

It’s a pity.
Then I will deal with the fact that there is.

(Tecnologiaterabyte) #48

Hello, I have been following and reviewing the development of yii3, and the truth is that now it is difficult to install the yii-project-template application in this way, when @hiqsol started, with a basic web skeleton and a common directory master skeleton. It was super simple, since it allowed the update of the base web skeleton; also the configuration per excellent idea module, now the resources must be installed using wikimedia/composer-merge-plugin, when previously they were simply installed in composer.json with https://active-packagist.org/, for anyone working in yii2 what think twice to migrate to yii3.

Sorry my bad english,

(Alexander Makarov) #49

@vanhelvzla thanks for feedback. The decision isn’t final and we want installation to be simple, please post to Basic template vs new Yii 3.0 template as well.

(Alexander Makarov) #50

@schmunk what do you think about increased installation complexity?

(Tecnologiaterabyte) #51

Steps for the Yii2 Web Application installation:

php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic

Steps for the Yii3 Web Application installation:

composer create-project --prefer-dist --stability=dev yiisoft/yii-project-template myapp
cd myapp
composer require yiisoft/yii-base-cli
composer require wikimedia/composer-merge-plugin
composer config repositories.ap '{"type": "composer", "url": "https://asset-packagist.org"}'
composer config extra.merge-plugin.include "vendor/*/*/composer.assets.json"
composer require foxy/foxy:^1.0.0
composer require yiisoft/yii-base-web
composer require yiisoft/rbac

The problem is not the number of steps, if it is understood because they are needed, that is why it is easier to mount the complete web application, which already had @hiqsol.

I’m not sure if I’m doing something wrong but I have the assets duplicated:


/public_html/node_modules ---> Assets Duplicate (bootstrap, jquery, popper)

/vendor/bower-asset ---> Assets Duplicate (bootstrap)
/vendor/npm-asset ---> Assets Duplicate (jquery, popper)

(Lyubomir Parvanov) #52

Does this work for you?

(Schmunk) #53

First of all, you either need

composer require wikimedia/composer-merge-plugin
composer config repositories.ap '{"type": "composer", "url": "https://asset-packagist.org"}'
composer config extra.merge-plugin.include "vendor/*/*/composer.assets.json"


composer require foxy/foxy:^1.0.0

and also only if you plan to create a web-application, installing both might also be the root-cause of duplicated assets. There’s still some work to do regarding asset handling in the extensions (eg. bower vs. npm and asset-packagist vs. native npm)

Adding no application-base was a design decision taken from here: https://github.com/yiisoft/yii-base-api/issues/1
You also do not need yii-base-cli and yiisoft/rbac, I think. So the web application installation should boil down to

composer create-project --prefer-dist --stability=dev yiisoft/yii-project-template myapp
cd myapp
composer require foxy/foxy:^1.0.0
composer require yiisoft/yii-base-web

(Schmunk) #54

Also said in my previous post, not everyone wants to install a web application, see https://github.com/yiisoft/yii-base-api/issues/1 - for example when thinking about a possible combination of Yii 3 as API + a VueJS app.

The goal of a template should be minimum code and maximum flexibility.

But there could be a full-fledged project template having “everything” pre-installed. But this statement is problematic, what and how should it be installed?

I.e. I’ll always use npm for future projects, but it was also a requirement that there’s a PHP only solution.

If people want an easy installation I’d suggest to create an example project based on the template.

(Tecnologiaterabyte) #55

I understand it perfectly, but it’s already a decision of @yiiteam, for me what I like about yii is that it’s different from Laravel and the symphony, its ease, its quick line of learning, how easy it is to develop a system, install the template and use gii that is the powerful thing, the new programming frameworks are focused on that path, and I think that sometimes here we go the other way.

(Schmunk) #56

What would you change? Install the web-base? With which asset system then?

While I don’t think the current setup process is final, I like that’s it is truly modular, flexible and scriptable.

We could also add some application init commands to yii-console, but these would be just for convenience.

(Tecnologiaterabyte) #57

Good day, particularly I think there should be a template to start web applications quickly since the design @hiqsol is already done, and I think it’s excellent because we can update the template without reinstalling something we can not do in yii2 it’s a great progress for all, on the other hand, you can have another template clean of zero so that the most experienced can add the packages of your choice, remember yii "It is fast, safe and efficient and works immediately and preconfigured with reasonable predetermined values. It’s easy to adjust to suit your needs, because Yii has been designed to be flexible. " We can not lose the objective framework.

(Schmunk) #58

I don’t agree that a web-application and asset-packagist is a reasonable predetermined value, especially based on the discussions linked above.
The current project template is especially designed to be flexible, but yeah it requires one or two more step in its setup.

@samdark Can/should we create a repo web-project-example or similar which is based on (or uses) yii-project-template and installs a yii-web-base with asset-packagist by default?

Also related: https://github.com/yiisoft/yii-console/issues/12

(Schmunk) #59

Just to note that here :slight_smile: I never use the Web UI, only the console, since the Web UI is so much limited when it comes to extending gii ie. with batch processing.

(Stefano Mtangoo) #60

My bad!
How do you use Gii console with batches? Any example/use case?