Yii news 2021, issue 3

Yii news 2021, issue 3 - Open Collective

Yii news 2021, issue 3

Hello, community!

Alex here again. Yii team was silent for a while. Not because of nothing happens but the opposite. Too much happens and all that at the same time.
It is pleasant to work on Yii 3 since it is finally getting more stable and more complete.

New Yii3 logo

Foundation

We have participated in FundOSS donation amplification pilot project.
In total, 49 donors participated raising $813 that was amplified to $3295 (minus Stripe fees). That is a very significant aid to the project
that will allow us to spend more time on framework development. Thanks to FundOSS, OpenCollective and, of course, our backers.
I really hope to participate in alike project again.

Community

We have soft-launched pre-release support for companies via Telegram.

From other news, IRC channel was moved to libera.

Also, there is now an experimental #yii3chronicles Telegram channel posting Yii development updates. For now, it is in Russian only,
but it is possible that there will be alike channel in English in the future.

Design and website

Last time I have posted about awesomic invited us to use the service for free to say thanks for Yii 2. Since then, some cool work was done. At “official logos and design” page you can now find various kinds of new logo, favicons set, general guidelines, and a guide to diagrams.

Also, I have added “Looking for Yii 3 progress?” link to main website front page. Hope that would bring additional interest and more issues and PRs.

:large_blue_diamond: Yii 1

Yii 1.1.24 was released. First generation of Yii got extended support until 2023-12-31.

:large_blue_diamond: Yii 2

A big set of updates is ready:

There are significant PHP 8 compatibility issues identified in API documentation generator.
We are on fixing it. Meanwhile, use PHP 7 for docs generation.

:large_orange_diamond: Yii 3

:gift: Package releases:

I have decided not to include patch releases in the list and not to post these at the website for now. Takes too much time and mostly these are of no big interest.

We have deprecated as few packages as well:

  • yiisoft/serializer.
  • yiisoft/container-proxy.
  • yiisoft/yii-debug-frontend (see below in Debugger section).

Currently, team main focus are yiisoft/factory and yiisoft/di.
These are blocking 11 and 31 package releases correspondingly.

Infrastructure

We decided to run all package tests overnight additionally to doing it on commits.
That would allow us to see if change in one package breaks another package. It is a rare situation for stable packages, but it is better to be sure than sorry.
It is not applied to all repositories yet but will be soon.

Yii Config package now requires Composer 2.0. The reason is that Composer 1 does not see new packages at packagist so Yii 3 cannot be installed.

Yii development tool

During development sometimes we see inconveniences of using our development tool so we improve it:

  • list command was added listing active packages.
  • Symlinks aren’t created anymore for disabled packages.
  • Packages are now processed in alphabetic order.
  • Any vendor package could now be added, not only yiisoft.

Application templates and demos

We have renamed “yii-demo” to just “demo” for consistency. Right now, the set of applications and demos is the following:

Minimal PHP version for all these was raised to PHP 8.0. Packages are still 7.4+ since these could be used separately.

Ability to add bootstrapping code was added. The config for it stays in config/bootstrap.php,
config/bootstrap-web.php, config/bootstrap-console.php
and is empty by default. You can add callables such as function (ContainerInterface $container): void. These will be called at application startup.

composer run serve command could be used as an alias of ./yii serve now.

Overall directories structure got a bit simpler, and we work on making it even more simple.

DI container and factory

Both DI container and factory are now blocking further releases so these are our main focus now and are under heavy refactoring and development:

  • They are becoming stricter with more validation in development mode and mostly one way to set definitions.
  • Error messages improved significantly providing more information.
  • Code coverage improved a lot.

Container:

Factory:

  • Factory::create() now accepts a single argument. A definition of the class to create.
  • Factory does not implement PSR ContainerInterface anymore. Factory::get() and Factory::has() were removed.
  • Circular references detection was added.

Queue

  • Configuration was simplified for simple cases. It is enough to configure AMQP broker and the rest would work out of the box.
  • It is more convenient to configure channels now.
  • AMQP adapter does basic ack for processed messages.

HTML

2.0.0 is being prepared. It adds new tags, optimizes output and improves usability.

Middleware dispatcher

The package is close to be tagged. We still check alternative ideas about its design but current one is almost perfect.

  • There are now proper docs in the package readme.
  • It became way more resource-saving. Middleware instantiation is now lazy. Additionally, middleware instances are memory-cached, so it’s performing better in event-loop
    environments such as RoadRunner and Swoole.

Validator

Validation rule syntax was adjusted:

// before
(new Number())->integer()->min(44);

// after
Number::rule()->integer()->min(44);

Yii Sentry

Sentry integration package was created. Sentry is a log aggregation service that allows to efficiently monitor application code issues in production
environments. Both web and console are supported.

Widgets

Error handling

Config

Overall documentation was updated and expanded.

Debugger

Since Angular version was dropped, we have got the following debugger packages left:

  • yiisoft/yii-debug is collecting debug info from your application.
  • yiisoft/yii-debug-api is a REST API that provides debug info collected.
  • yiisoft/yii-debug-viewer is a new client that could be both used as a module in an existing application
    or launched as a separate application. Adding your own panels is much easier than it was in the Angular version and is comparable to Yii2.

Viewer was added to application templates and demos and is accessible at http://127.0.0.1:8080/debug/viewer where 127.0.0.1:8080 is your local development host and port.

Router

Both internal refactorings and external API changes were made.

  • When configuring a route in the application, IDE won’t auto-complete non-configuration methods.
  • Way less internals are exposed now to end user.
  • Current route is now available through separate Yiisoft\Router\CurrentRoute service.
  • Added ability to specify host for a group via Group::host().
  • Added ability to specify group prefix via Group::namePrefix().

:orange_book: New and adjusted docs

Overall the guide was updated to match current code and
most packages now have up-to-date README.

:books: Reading/watching recommendations

:heart: Thank you!

I would like to thank all backers and contributors for making Yii 3 possible.
We are moving it forward together!

There are more individuals and companies to be checked on the OpenCollective page.

:+1: Special thanks for Yii 3 code contributions goes to:

3 Likes