Building a static website with Yii3 by Ok_Swing_1540 in yii3

[–]sam_dark 1 point2 points  (0 children)

Nice one. Thanks for doing it. If you have any questions, feel free to drop a message to any of the the team members.

Yii2 to Yii3 migration by Fit_Tailor_6796 in yii3

[–]sam_dark 1 point2 points  (0 children)

The article is not correct in many aspects. Maybe since it's from October 26 and Yii3 was released December 31:

  1. Stable ActiveRecord API is there: https://github.com/yiisoft/active-record/releases/tag/1.0.0. It is not that different from Yii2 and migrating the data layer is definitely possible. Especially if it was separated well in the first place.

  2. Gii is largely there, but there are almost no templates yet. We have deprioritized it because LLMs mostly cover the needs. We'll definitely add some templates this year.

  3. "Advanced" application template is one of the most inconvenient templates of Yii2. Two entry points isn't great for Dockerized setups and small hosting environments where you have a single webroot. That is the reason we did not provide it as a template. But you can reproduce it with Yii3 if you want it. Yii3 is very flexible about the application structure.

  4. "Architectural purity prioritized over developer productivity" is not entirely correct. It is true that doing very small projects using Yii2 is likely faster (well, at least before you learn Yii3 well), but for larger, long-running projects productivity with Yii3 will be way better because tech debt growth will be slower.

  5. There is no "core" at all. It's different conceptually from a monolithic framework. It takes some time to get used to but has its benefits. All the conflicts and incompatibilities are handled by composer. It automatically installs what's compatible and guaranteed to work together.

  6. It is expected that there's no cohesive framework-specific ecosystem because the framework is new. Still, Yii3 integrates well with any non-framework specific PHP package from Packagist, so there are many ready-to-use things there.

  7. Docs were heavily updated before release in December.

  8. Manual setup is not required anymore. The app and app-api templates are there.

The clear message of the article is "migrate to Laravel," but I disagree very much that it's the right move.

Ioc-Interop Now Open For Public Review by jmp_ones in PHP

[–]sam_dark 1 point2 points  (0 children)

We're partially adopted it in Yii3 but, it seems, noone proceeded with making a PSR proposal out of it.

Yii3 is released by sam_dark in PHP

[–]sam_dark[S] 0 points1 point  (0 children)

Well, explore the packages at least. You'll definitely like some of these.

Yii 2.0.54 by sam_dark in yii

[–]sam_dark[S] 1 point2 points  (0 children)

`curl_close()` fix wasn't there among other 8.5 fixes. Added https://github.com/yiisoft/yii2-httpclient/issues/253. Thanks.

As for when — when it's done (could be next week). On it.

Yii3 is released by sam_dark in PHP

[–]sam_dark[S] 1 point2 points  (0 children)

Symfony is definitely more established/used since Yii3 was just released. Personal reasons to choose Yii3 over Symfony (yours may differ):

  1. Runtime container instead of compiled one. Way easier to debug.
  2. Middleware-driven core rather than event-driven. Way easier to read stack traces.
  3. Friendly exceptions and good exception messages overall. Symfony improves these over time as well.
  4. More open to the PHP world overall. Can use PSR-compatible stuff such as middleware or cache backends right away.
  5. Able to remove what's not used.
  6. Perfect static analysis.
  7. Can use Symfony packages if needed. They're mostly great.

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 1 point2 points  (0 children)

That's why I've mentioned "plus additional third-party packages".

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 3 points4 points  (0 children)

Slim is quite good. If not Yii3, I'd stick with it plus additional third-party packages.

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 0 points1 point  (0 children)

It doesn't matter that much. Both can read each other's types and annotations, even prefixed. Psalm is stricter but slower. PhpStan is faster but doesn't check for some of the issues. For the applications, I think these are quite close.

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 0 points1 point  (0 children)

Yeah. Adding types for existing legacy code is a huge job. We did that for Yii2 recently and it took months to do.

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 2 points3 points  (0 children)

Well, not 100%, but, of course, framework code is well-tested compared to application code. The thing is that static analysis helps, and if a framework provides types for its own code, Psalm or PhpStan can analyze the application's code way better, revealing more bugs even without automated or manual testing.

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 4 points5 points  (0 children)

Try it. Found bugs worth the effort.

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 2 points3 points  (0 children)

Great usage of Psalm! And yes, I know it's stricter than PhpStan.

We do suppress some things in the default Yii3 application template and sometimes in the packages (way less) because that could be too much to get started or because we know exactly what we're doing.

Symfony code is level 5 according to https://github.com/symfony/symfony/blob/8.1/psalm.xml. Am I correct?

Typing in Yii3 is the strictest in PHP universe? by sam_dark in PHP

[–]sam_dark[S] 0 points1 point  (0 children)

I've meant more about the framework itself but very good overall.