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

The main reason is migration path. Migration from Yii 1.1 to Yii 2 was hard, but at least you could install these 2 frameworks at the same time and migrate some parts of app step by step. This was possible because there was only one class which had FQN conflicts (Yii), but with some hacks, you could make it work.
Migration from Yii 2 to Yii 3 is also going to be hard, but unlike in Yii 1.1 ==> Yii 2 case, you will not be able to install Yii 2 and Yii 3 in the same project, since Yii 2 and Yii 3 shares the same FQN for most of classes. There will be no way to migrate step by step - you need to migrate all at once. For some big app, this means that migration from Yii 2 to Yii 3 will be impossible - it will be easier to migrate to completely different framework than to Yii 3 (since you will be able to install Yii 2 and different framework at the same and migrate only part of the code in each sprint). There will be no such problem if we use different root namespace than in Yii 2.

It may also better reflect the character of Yiisoft packages - now they’re more framework-agnostic. Using Yiisoft as namespace may fit better for generic packages (this is no longer extension to Yii, why it has Yii as part of the namespace?).

11 Likes

This makes perfect sense since Yiisoft is actual vendor and in addition it will help with migration process. I’m all for it.

Looks good to me.

Agreed. @samdark ?

I’m neutral on the subject. @cebe? @hiqsol? @SilverFire?

It sounds good also for me.

But what for other packages, for example helpers? How will it become Html helper, “yiisoft/helpers/Html” or “yiisoft/yii/helpers/Html” ?

Yiisoft is longer. More characters to read, more characters to type. Not a huge issue but still it is a con.

8 Likes

I’m against this.
In the long run you’ll write so much more code, much more than needed, and for what? For couple of people that want to run the two frameworks together? I don’t think this is a good reason. Just migrate and be done with it. or stick to 2.x

2 Likes

Makes sense, IMO. … or Yii3/… (when this is considered the 3rd generation of the framework)
And the argument that the first part should actually be the vendor also makes sense.

1 Like

I preferer simply yii.
Shorter.
Fewer changes to existing projects.

Considering 2=>3 migration: I have production project working on both 2 and 3. It is not very difficult. The hardest part is changed configuration and not namespaces.
Also I thought same FQNs for the same classes is good cause it just works.
I mean according to my experience fewer changes makes easier migration.

7 Likes

Installing Yii 2 and Yii 3 in the same project should be restricted by Composer constraints. So it is rather impossible than “not very difficult” (it may temporary work, because of early stage of Yii 3 development).

And you will need to change namespaces anyway, since migration to PascalCase namespaces already started.

These are not the same classes.

@Thoulah what would happen when version will become 4.0? That would happen quite soon since we have switched to SemVer.

Changing namespace for each version update? It would be a mess

6 Likes

I would consider it rather a “generation” of Yii.

The upcoming Yii 3.0.0 is Yii3, but it could also be considered Yii3 V 1.0. The planned Yii 4.0 is then still Yii3, but Yii3 V 2.0 and so on.

Basically as if Yii V 3.0.0 was a completely new framework and renamed to Foo now (It’s just not Foo, but Yii3). And if the need for a huge redesign comes up in the future it becomes Bar (oops I mean Yii4).

I think the Yii3-Namespace could be kept as long no major architecture changes are made.

The discussion about namespaces and prefixing now is necessary because Yii3 is a major redesign, not just a new major version with big improvements and some BC-Breaks which can be worked around easily. It has has completely different package dependencies (not just version restrictions).

Of course such major breaking changes should be avoided in the future as much as possible - but in may be 10 years or so it might be necessary to redesign it again. Having the “Generation” in the namespace and package names would make this easier. But of course the current generation should live as possible.

I would not consider this just a “new version”, but “a new library” because of the major design changes.
But as long things basically stay compatible there is no need to change the “product name” again.

2 Likes

That is why keeping it as just Yii is very appealing from ease of writing / reading standpoint.

1 Like

Well, yes, I agree. Yii 1 is outdated anyway. We have Yii2, and of course it would not cause much trouble to just name it yii now.
But using Yii3 (for a long, long time I would hope) would

  • separate it from Yii 1 stuff (minor advantage, not rally a big deal)
  • Open a way for the future for new “huge new generations” (which should be avoided as much as possible of course - but who knows)

All approaches have it’s pro and cons and I would not consider any of them really crazy and I am also OK with just using yii-(packages) and YiiSoft… (Namespaces). There are now conflicts with yii2-stuff and I think Yii 1.x-stuff can be ignored. Using Yii3 would just have the advantage of continuing to follow a pattern which was introduced with Yii2, and still having a unique “product name”.

I’m in favor of just keeping it as “Yii” ¯_(ツ)_/¯

1 Like

And it’s also the sane approach.

It’s like i can see in future, people asking, but why do we type Yii3?
And the answer is: well, you know… we’re now at version 20.0.0 since we’re following semver and somehow we took a horrendous decision 5 years ago and named this namespace Yii3 because that’s when we did the switch, but it’s fine, ignore the number, we fucked up then, don’t ask.

Also, using Yiisoft makes no sense. I am not using Yiisoft, i am using Yii.

If you’re so keen to go this direction, just change the framework name altogether, call it Yava (java!), and that’s it, job done.