https://opencollective.com/yiisoft/updates/yii-news-2020-issue-7
Hello everyone! It is another issue of Yii news. As usual, we have Yii 2 releases, Yii 3 updates, important Yii 1 updates and other news. Have a good read and stay healthy. - Alexander Makarov
Foundation
Since last time I had to spend some time taking care about the foundation. Notable, the way funds are transferred from GitHub Sponsors to OpenCollective. They went from GitHub alright but where to was a big question. It took time to figure it out but now it’s solved.
Another foundation-related thing is that the author of httpsoft/http-message, Evgeniy Zyubin, will likely join the team full-time to speed things up if/when I’ll find extra funds for it.
Infrastructure
We’re constantly improving testing process of all the packages:
-
Added Roave backwards compatibility check to packages with stable versions.
It verifies that public API is not broken compared to the latest stable version. - We are further moving from Travis to GitHub actions for both Yii 2 and Yii 3.
They proved to be awesome and Travis recently cut OpenSource support, so it is great we have started early. - We decided not to send coverage from PHPUnit to Scrutinizer CI anymore but generate it with Scrutinizer itself.
It is way faster with the same result. - Psalm proved to be very useful. Highly recommend it for your projects as well.
- Colors were added to GitHub actions console. Looks way better!
A few adjustments were made to the website. Mostly these are GitHub API deprecation fixes and minor frontend adjustments.
Yii 2 and Yii 1 PHPUnit compatibility patches were extracted into separate repository so in case you need to test your application on PHP 5.3 - PHP 8 range, these will be handy.
Yii 1
- Yii 1.1 will be supported for one more year thanks to Skillshare and Onetwist Software.
- Marco van 't Wout from Tremani web agency officially joined Yii maintenance 1.1 team.
Yii 2
Yii 2.0.39 was released enhancing dependency injection container and fixing more PHP 8 compatibility issues.
From the less visible improvements, we’ve changed the way annotations are generated for magic properties so now some IDEs, including PhpStorm, will recognize read-only and write-only properties.
The following extensions were released as well:
Yii 3
The following package releases were made since last time:
Overall plan is to prepare the packages listed in this Trello card.
There are multiple interesting decisions:
- All stable releases will start with 1.0.0. Previously a variant of starting with 3.0.0 was discussed.
- Yii 3.0 packages will support PHP 7.4.
- Default configurations were added to majority of packages. Most will work without any extra configuration or with minimal of configuration.
- Configuration providers are mostly removed from packages and apps.
There is a Trello board with tasks we’re working on including ones not
reflected in GitHub issues.
Nearly every package received cleanup, PHP 8 compatibility and bug fixes. Below are some selected highlights.
New packages
Some new packages were created both as a result of extracting common parts of existing packages and new ideas.
- JWT authentication method.
- Yii Swagger.
- Draft version of API template was created. It is more like a demo now but later part of current code will be deleted, so it will become a real template to start your APIs with.
- Request model. It helps to validate and transform request data before using it.
- Middleware dispatcher was extracted out of the router and request-model.
- Error handler was moved out of yii-web.
Development tool
- Dependencies were revised and Dockerfile was added.
- Ability to semi-automatic release tagging was implemented.
Composer config plugin
Temporary PHP 8 support was added. It’s not the same as our AST effort and is meant to ease checking things for PHP 8 while we’re finishing AST version.
Container and factory
- Dependencies were actualized for both packages.
- Self-referencing container definition hack is no longer needed.
- Support for PHP 8 union types.
- Dependencies are now resolved for both constructor and method when calling non-static factories such as
'engine' => [EngineFactory::class, 'createMethod']
. - Definitions are now resolved in array configs.
-
Callable arguments are now resolved from DI container. Added
Reference::toCall()
. - Any definition could now be used for constructor arguments.
Cache
Bulma
- More docs, better naming.
- Added ability to use icons in dropdown menu.
- All widgets were made immutable.
Router
- Router internals and configuration were both made simpler by extracting routes collection into separate class.
-
UrlMatcherInterface::getLastMatchedRequest()
was removed andgetCurrentUri()
was added. -
UrlMatcher
is now optional which is handy for console applications.
Application templates and demo
- NodeJs is no more required. Assets are fetched from asset packagist.
- Configs were significantly cleaned up. In the app, they were split per-package.
- Self-referencing container definition hack was removed.
- Swagger was added to yii-demo. It can be accessed via
/swagger
. - Multiple refactorings were made in yii-demo.
- yii-demo PSR-7 implementation was switched to httpsoft/http-message.
Var dumper
-
Added
asPhpString()
method to export anything as code including closures.
Files
Cycle
- File schema is now writeable and supports multiple files to read from.
- Our own DI container / factory are now used so Cycle integration is now PHP 8 compatible.
Data
DBAL and ActiveRecord
Both DBAL and ActiveRecord ported from Yii 2 have lots of refactoring to be done despite functionally they were significantly cleaned up and mostly work.
Arrays
- Removing value by path was moved to a separate method.
-
ArrayHelper::isTraversable()
was removed in favor of usingis_iterable()
directly.
HTML
- Cleanup was made.
- Added Html::generateId().
- Added option “wrapInput” for checkbox and radio.
- “aria” was added to data attributes.
-
Removed
Html::getAttributeName
. - Removed
escapeJsRegularExpression
, addnormalizeRegexpPattern
. - Added encoding methods for different contexts: HTML attribute, HTML attribute without quotes, JavaScript string value.
-
decode()
was removed.
Debugger
- Detail object data was added to API.
- There is progress on debugger frontend.
- Added ability to set history size.
Queue
- Significant cleanup, more tests.
- Signal loop was improved by introducing soft memory limit, extra events and signals config.
- Documentation was updated.
- Separate payloads were removed simplifying everything.
Translator
i18n packages were deprecated, translator packages were introduced with adjusted design.
New and adjusted docs
Reading recommendations and other news
- On not choosing WordPress for the W3C redesign project. W3C, an organization that works on web standards, chose Yii2-powered Craft CMS to power their website.
- Composer 2 was released. We are ready, so you can upgrade and get significant performance improvement.
- Yii 2 PhpStorm plugin was updated to fix compatibility with latest IDE versions.
- PHP 8.0: What’s New and Changed.
Thank you!
I’d like to thank all backers and contributors making Yii 3 possible.
We are moving it forward together.
Special thanks for Yii 3 code contributions goes to:
- Wilmer Arambula.
- Rustam Mamadaminov.
- mj4444.
- Dmitriy Gritsenko.
- Roman Tsurkanu.
- yiiliveext.
- Sergei Predvoditelev.
- DarkDef.
- Viktor Babanov.
- Dzianis JackieviÄŤ.
- Alexander Nekrasov.
- Anton Samoylenko.
- Dmitry Derepko.
- Alexey Chernousov.
- Andrii Vasyliev.
- wiperawa.
- Aleksei Gagarin.
- Bruce Aldridge.
- Sergei Iamskoi.
- Maksym Storchak.
- Evgeniy Tkachenko.