Irritating "yiisoft/yii2": "*"

It is a bit confusing, to see each and every Yii2 extension’s composer.json file has the following entry in its “require” section:

"yiisoft/yii2": "*"

Yeap - the result is that in case I want to use this extension in any other context - Composer anyway loads and install spare Yii2 files.

Hey dear developers - there is really no need to add this - please, do not force the end user into unnecessary obligations!!!

For your info - I try to implement two "vendor" folders: one shared between multiple applications (with Yii2 framework files and set of common extensions) and one "private" - to be used by particular application only.

That will help to maintain the things and save server resources. But then, obligatory installation for Yii with each extension in app’s “private” vendor folder is very confusing!

So… What would you recommend people use instead?


In fact, there’s a need. Composer.json files must declare all dependencies to be valid and usable. Your use case isn’t the only possible one.

Composer has built-in support for installing packages globally. Maybe that’s what you are looking for?

Hmm… what you’re doing is kinda against what Composer is for. In composer packages you’re specifying dependencies and extension packages do depend on Yii core in order to function.


It seems I have no choice - I ended with Composer-driven global ‘vendor’ and manualy installed ‘local’ extensions.

This looks like the only possible compromise.

Composer has built-in support for installing packages globally. Maybe that’s what you are looking for?


Yeah - but this Composer "global" folder structure is a bit far from web-server reality. I need a system good for application development supporting easy deployment of production-ready applications on a distant web servers.

Composer is for managing the package dependencies and you will have a conflict if you wish to bypass that.

To give an example, what you say is actually not directly true. Well I have not used yiisoft/yii2 directly as a dependency in composer.json in almost all my Krajee Yii2 extensions.

But then my extensions have a dependency on yiisoft/yii2-bootstrap :) … which in turn has a dependency on yiisoft/yii2. So, you will end up getting all dependent packages including the yii framework installed.

So yes… you cannot avoid this dependency if you use composer as the package manager and you should not be using composer if you do not want this.