Yii news 2020, issue 8

https://opencollective.com/yiisoft/updates/yii-news-2020-issue-8

Hello, everyone! This is the last Yii news issue of crazy 2020. I have barely managed to put it together because of Yii 3 development speed increased a lot.
We haven’t tagged all package releases this month, but many packages are very close so expect more releases in January.

Happy New Year! Let it be a bit less crazy than 2020. - Alexander Makarov

// Don’t forget to star packages you like at GitHub.

Foundation and team

  • Evgeniy Zyubin joined the team full-time to work on Yii 3 and did great so far.
  • Valerii Gorbachev joined the team as well. You likely know him for the work on i18n and MSSQL.
  • All available funding is now spent giving more time to the team and resulting in a massive development speed boost.

The year proved that we can efficiently spend funds on development so contributing financially helps the project really well.

:large_blue_diamond: Yii 1

Yii 1.1.23 was released.
It adds support for PHP 8 and improves compatibility for PHP 7. It also adds support for PostgreSQL 12.

That is the first release Marco van 't Wout tagged with the help of Carsten Brandt.

:large_blue_diamond: Yii 2

Yii 2.0.40 release was done. The release is mostly focused on fixing issues found since last release.

The following extensions were released as well:

Additionally:

:large_orange_diamond: Yii 3

Infrastructure

  • Applied new StyleCI rules to all repositories. Code style is even more consistent now.
  • Overall tests coverage and mutation score were increased for nealy every package.
  • Trimmed Git history of some packages that were sub-split from Yii 2 back then and were dragging all of its git history.
  • Enabled GitHub discussions in yiisoft/app. Will see how it goes. It is not meant to replace forums but may serve us good.

Releases

New packages

Not only packages get added… some packages were removed such as yii-api.

Arrays

Files helper and file system

File helper got the following changes:

  • Added FileHelper::isEmptyDirectory().
  • Added FileHelper::openFile().
  • Added FileHelper::lastModifiedTime() that is able to get last modification time for a directory contents.
  • Added FileHelper::findDirectories() and FileHelper::findFiles().
  • FileHelper::unlink() now handles more edge cases including Windows.
  • FileHelper::filterPath() was replaced with separate PathMatcher.

File system package now uses stable version of Flysystem.

Console

public/index.php is now used as router by default in yii serve command.
That was made to handle routes with dot in them with the build-in server.

DB and Active Record

Good progress was made to clean up Yii2-ported database package.
It’s far from being complete, but we’re getting there. Interesting changes:

Migrations

Cycle DB

Error handler

Error pages got new design provided by Arkadiy Zimn and Fedor Dostoevsky.



You can switch to dark/light theme so night coding errors won’t burn your eyes anymore.



Debugger

  • Server parts of debugger got cleanup, collector improvements and fixes.
  • It now requires way less manual configuration and could be turned on with a simple boolean flag in the config.
  • Memory usage calculation was fixed.
  • All the reading and writing is now done through proper abstraction.

Frontend part of debugger is still in the heavy development.

Profiler

  • Overall cleanup and refactoring was performed.
  • Default configuration was added.

Development tool

Development tool got some improvements:

  • Refactoring was done.
  • test command that silently does tests for a package and prints only if there are errors.
  • git/pr/create command that is able to create GitHub pull requests.
  • github/settings command that helps mass-changing settings of GitHub repositories.
  • Error became more helpful.
  • replicate/copy-file command that is able to copy any file to all the packages specified.
  • It now plays nicely with symlinks in Docker containers.
  • exec output is now realtime.
  • release/make command got extra checks and workflows. That’s what was used for recent package releases.

Translator

  • Message drivers for gettext and database were refactored.
  • README docs were added.

The package is almost ready for stable release.

Demo application

Demo application is kept up to date with recent framework changes.

Web application template

Also, there’s new start page:



API application template

The template currently contains some example parts that are better to be in the demo.
Closer to release these will be moved.

Cache

Cache was significantly refactored. Yii’s cache package became a non-PSR cache that uses PSR-16 handlers.
It is able to set default TTL and prefix, provides cache stampede protection, and dependency invalidation.

Most handlers were cleaned up and refactored so expect release in the beginning of the next year.

Log

Log got major cleanup and refactoring as well. For end user it still is a PSR-compatible logger but configuration and feature-wise
it became a lot better:

  • Customizable log format.
  • StreamTarget was added for writing to the output stream.
  • Resource consumption was reduced.
  • There’s now ability to add your own context.

Var dumper

  • Better edge case handling.
  • More tests and refactoring.
  • Exporting of closures was extracted into its own class, ClosureExporter.

Bootstrap

Various updates were made to both Bootstrap 4 and Bootstrap 5 packages.

Bulma

Router

Serializer

The package future is to be considered.
While it proved to be useful for some cases, in simple cases it’s an overkill and in complex cases it’s often not enough.

HTML

  • Cleanup, deprecations removed.
  • Add Html::div(), Html::span() and Html::p().

Assets

Widgets

Public API was adjusted significantly to support immutability within widgets.
Personally I think that syntax got better:

<?= MyWidget::widget()->options(['class' => 'testMe'])->begin() ?>
    Content
<?= MyWidget::end() ?>

CSRF

CSRF got major refactoring. As a result:

  • It is more logically structured.
  • More secure.
  • Got interfaces to implement your own protection algorithms.
  • Got stateless token algorithm support out of the box.
  • Got default configs.

First third party packages

While Yii 3 is not released yet, there are some third party packages appearing for it. One we’ll highlight today is about inlining SVGs:

:orange_book: New and adjusted docs

Overall documentation is now outdated. The concepts are the same but concrete syntax was adjusted in the code.
It will be worked on next year.

:books: Reading recommendations and other news

:heart: Thank you!

I’d like to thank all backers and contributors making Yii 3 possible.
We are moving it forward together.

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

11 Likes