Use `Yiisoft` as a root namespace instead of `Yii` for Yii 3 packages


If you have class with FQN like Foo\Bar\Baz, then Foo is not a framework name, it is a vendor name. And in case of Yii framework the vendor is Yiisoft, not Yii. You should be aware of that, since you’re installing yiisoft/yii2, not yii/yii2.

(Serban Cristian) #23

I am. I mean, i am using Yii for quite a while. The idea is that new people have no clue about who yiisoft is. I won’t get into more details about this, but i really hope from all the above your takeaway is not this.

Another point against this naming convention is people that will have yii2 projects and yii3 projects in parallel, switching between the projects will add extra cognitive load without reasons.

Anyway, that’s my 2 cents related to the issue and i think it’s pretty clear it would be a silly move, but up to you.


They literally just installed yiisoft/* package, expecting namespaces started from yiisoft should be natural (most of packages works in this way, convention used in yiisoft/yii2 was quite unnatural in this matter).
Also Yii 3 will not be just a framework like in case of Yii 1 and Yii 2, it will be more like ecosystem of libraries, which can be used with any framework/stack. Using framework-agnostic namespace may actually help in adoption of some packages, since there will be no confusion like “hey, I’m using Laravel in my project, I should not use this Yii library because it is a different framework”.

Actually I think it will help, since it will be easier to notice difference between Yii version used in application. Yii 3 will require different approach for writing code than Yii 2, so you need to switch context anyway - the more obvious difference will be, the less WTFs you will get.

(Sidney Lins) #25

Namespaces and classes MUST follow an “autoloading” PSR: [PSR-0, PSR-4].

This means each class is in a file by itself, and is in a namespace of at least one level: a top-level vendor name.


So, I am for use Vendor\Foo, Yiisoft\Foo.

(Ziggi) #26

Yii3 - a perfect match for a handy but meaningful name!

(Lubosdz) #27

I would not care about installing two frameworks at the same time - that’s rare and temporary scenario.
Introducing new namespacing scheme for each major release is not good idea.
Simply keeping namespace yii is still best IMHO - it’s short and unique.

If you use Yiisoft now, then what would be next global namespace for major release to distinguish? Introducing Yiisoft does not solve anything.

BTW - for better orientation it would be perfect to keep framework versioning synced, e.g. namespace yii3 for version 4.x.x would be just confusing.

(Alexander Makarov) #28

Yiisoft is about making root namespace a vendor name. Since we now have libraries that could be used separately from the framework, it makes sense.


There will be no change in namespace in next major release, since Yii 4 will not be complete rewrite - only evolution with some BC breaks. That was the point of removing number from package name - ability to make major release which will not be different framework.

(Amjad Mughal) #30

My vote for Yii

(Sizemail) #31

no matter on char length to type or pronounce in namespace.

(Knight Yoshi) #32

I think this is the only actual objective reasoning for this. The rest are just preferences.
Given this reasoning, I’d be fine with Yiisoft as the root namespace.

What about creating an alias in Composer, for Yiisoft/yii to yii? This way everyone gets their cake and can eat it too.

(Mehdi Achour) #33

People are free to do so in their own composer files.
Also, some namespaces don’t have Yii in them, only Yiisoft.

See samples here:

(Red ones still needs to be properly namespaces)