Yii news 2020, issue 6
Yii news 2020, issue 6
Almost three months passed since the last Yii news issue. We were almost silent and working hard. These days with Yii 3 team expansion I am managing, reviewing, designing, and guiding more, writing code less. That works pretty well, I can say. Overall development tempo increased, and we're getting closer to our next goals.
An official forum is way less active compared to how it was in Yii 1 and Yii 2 times. People moved to various social networks and chats. I think that is an unfortunate move because in all these media it's nearly impossible to search for previous answers. People are asking the same things over and over again and the answer does not end up in search results. I think that whoever first will note all these questions and answers and post these as wikis will get lots of recognition.
Anyway, let's move to what happened since the last issue.
🔷 Yii 1
Onetwist Software contacted me asking for PHP 8 in Yii 1.1 in exchange for donations to the foundation (that is mostly spent on Yii 3). As a result, 1.1 master branch got initial PHP 8 support. We wait for issues to be found before tagging a release but none were found so far.
Not only code got patched:
- Pipelines were moved to GitHub actions from TravisCI.
- Tests are now executed with PHP 5.3 - PHP 8.0. Had to patch the legacy PHPUnit version, but it worked in the end. Going to partially reuse that for Yii 2.
From other Yii 1.1 news, Marco van 't Wout, a long time Yii user, volunteered to take care of incoming issues and likely doing Yii 1.1 un-official support and releases for a bit longer than we have planned initially. Will see how it goes.
🔷 Yii 2
- Yii 2.0.37. PhpStorm IDE code-completion got better, and the way exceptions are printed out in console application when in debug mode was improved.
- Yii 2.0.38. PHP 8 support. Latest databases support. A security issue was fixed.
- ElasticSearch 2.1.0. Support for version 5 to current version 7.
- ApiDoc 2.1.5. PHP 7 compatibility fixes.
- Yii and extension manuals in various formats.
🔶 Yii 3
2020 is not easy, and many things did not go according to plan moving release dates that I carelessly mentioned a few times. Still, public API is stabilizing, and many contributions now are about bug-fixes and adjustments rather than re-design. There are, of course, some parts that are to be adjusted or re-thought, including configuration. I am still not entirely happy about it.
We've released some stable packages. These are all framework-independent ones and could be used in any PHP application:
More packages are on the way.
Below are interesting changes and additions.
Tests and cleanup
- We've added PHP 8 to all package version constraints and test pipelines. Most of the packages are now compatible but not all of them.
- After some time with phan we are switching to Psalm. It is more popular, has more features, and is supported in PhpStorm.
- We have added more tests to many packages, and many tests got improvements based on Infection mutation testing results. Many fixes were made along with overall cleanup.
- The test support package was added for Yii 3 team convenience when covering packages with tests. Potentially it can be handy for application tests as well.
- yiisoft/yii-event was added to provide a configurator for events. It is used in both web and CLI. The most visible change for an end-user is that dependencies are auto-injected now into event handlers.
- The data response package was extracted from yii-web. It provides an ability to respond with raw data and then format it separately into XML, JSON, etc.
- New request body-parser package that provides a middleware to parse body based on content-type specified.
- Multiple additions were made to the Bulma support package. It is currently used to style the default application template.
- The main queue package got a nearly stable API. We did initial implementation and some polishing in AMQP driver.
- Validator package got structural improvements.
- Cycle ORM package got cycle/schema/clear command and a filterable data reader.
- Yii DBAL and drivers are being polished more and more and are starting to look well. There is a chance these will be available with Yii 3 release.
- Host-matching was implemented in the router package.
- The event dispatcher got a friendly class approach replaced with a more convenient one.
- Dot-separated nested form attributes are now supported in yiisoft/form package.
- Cookies were moved to separate package from yii-web.
- The data package got interface cleanup based on its usage with Cycle ORM.
- The arrays package got some extra modifiers and was overall refactored and covered more with tests.
- The router got more flexibility in the way it executes route matched.
- Validator configuration could now be converted to an array that is useful for further JSON-serializing it and passing to a frontend framework implementing client-side validation.
- File helper got the ability to clear directory without removing it.
- CSRF package was extracted from yii-web and then significantly adjusted.
- The session was moved to a separate package from yii-web.
- RevertibleMigrationInterface was introduced to yii-db-migration package.
- Redis connection for DBAL was ported from Yii 2.
- There are improvements in debugger data collection, API is nearly ready and the draft Angular-based frontend is in progress. We still have to figure out how to make providing extra panels in packages convenient but overall it's going well.
- The message translation redesign was made. Implementation is on the way.
Demo and application template
- The demo project was expanded and refactored to reflect the current state of things more. It is still not using some good practices from yiisoft/app and vice versa. These will be synced soon.
- For the yiisoft/app we are trying httpsoft/http-message instead of nyholm/psr7 as default PSR-7 and PSR-17 implementation. The reason is that it is more performant.
- Composer config plugin got some adjustments and, as a result, it became obvious it needs its internals redesigned and re-implemented. The redesign is done. Implementation is in progress.
If you want to join the fun, feel free to contact me via email, official forum, Slack, or any other channel.
The team expanded again. The current status is reflected at the website:
Also, we've added Dmitry Derepko to the page, but actually, he worked on Yii 3 for quite some time already. He was just missing from the page :)
📙 New and adjusted internal guidelines:
📙 New and adjusted guide pages:
- YiiPowered got 597 projects. If you haven't added yours, please do it. You can even skip the screenshot part. It will be grabbed from a real website overnight.
📚 Reading recommendations
- Enhancements to PHP code coverage in 2020.
- Usage of friendly classes.
- Optimize Images with a GitHub Action.
❤️ 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.
- Alexander Nekrasov.
- Dmitry Derepko.
- Viktor Babanov.
- Rustam Mamadaminov.
- Roman Tsurkanu.
- Maksym Storchak.
- Alexey Kopytko.
- Sergei Predvoditelev.
- Dmitriy Gritsenko.
- Anton Samoylenko.
- Arman Poghosyan.
- Leonid Chernenko.
- Andrii Vasyliev.
- Yuriy Mamaev.
- Aleksei Gagarin.
- Michael Härtl.