https://opencollective.com/yiisoft/updates/yii-news-2020-issue-5
Hello, community!
It is time for another Yii news issue. Both Yii 2 and Yii 3 are doing well.
I’ve finally updated the team page on the website to reflect the current state of things.
Konstantin Sirotkin is back and actively taking care of ElasticSearch Yii 2 extension.
Yii 3 main team was formed (actually happened late 2019). Likely you know the names because most were mentioned in previous Yii news issues.
Also, we have partially moved to GitHub actions. Experience is great so far, so we can definitely recommend that. We’re adding phan static analysis
and running tests with Infection to make code quality even better.
I’ve spent some time on YiiPowered, a place to collect Yii-powered projects that has 571 projects listed so far. Enhancements are:
- Ability to add projects made with Yii 3.0.
- Images are automatically fetched from the real website every night for published projects with missing images.
Last time I have mentioned PHP Russia Online conference.
It went well and videos are already available.
As an experiment, I’ve recorded a video of me working on code reviews. I’d really like to know your opinion on it. Is it worth doing something like these more?
Do you want to know any part of the Yii development process or internals?
Yii 2
Version 2.0.36 was released. It is an important release because of dependency injection container enhancements. It is now closer in features to the one in Yii 3.
In both web controller actions and console controller actions, the following now is possible:
namespace app\controllers;
use yii\web\Controller;
use app\components\BookingInterface;
class HotelController extends Controller
{
public function actionBook($id, BookingInterface $bookingService)
{
$result = $bookingService->book($id);
// ...
}
}
Another enhancement is that references are now resolved in arrays:
return [
ContentTypeMiddleware::class => [
'__construct()' => [
Instance::of(StreamFactory::class),
[
'json' => Intance::of(JsonFormatter::class),
'yaml' => Intance::of(YamlFormatter::class),
],
],
],
];
Additionally, the following extension releases were made:
- Composer installer 2.0.10 enhancing Composer 2 support.
- ElasticSearch 2.0.6 and 2.0.7 fixing bugs in “legacy” releases.
Yii 3
First, the application template was implemented. You can start exploring Yii 3 with it. It is not final but should give you a good overview of Yii 3. Suggestions are very welcome.
- A stable version of Aliases package was released with 100% test coverage and a 100% mutation score.
- Injector 1.0.1 was released adding PHP 8 support.
- Form widgets were added to yiisoft/form. There were other enhancements as well.
- More packages got strict types.
- More tests were added to yiisoft/gii, yiisoft/yii-web.
- Auto-login middleware you probably know as “remember me” was implemented.
- Composer config plugin was covered with more tests and can now rebuild configs without preliminary build. It now also generates fewer files and has limited support for environment variables. Finally, it now works with Composer 2.
- ErrorHandler error HTML page could now be customized.
- Console application got
ApplicationStartup
andApplicationShutdown
events, and a nice way to configure event handlers viaconfig/events-console.php
. These are currently used in yiisoft/yii-debug.
Overall config was refreshed adopting a new style and allowing more customization. - Twig view renderer was implemented.
- route/list command was added to yii-demo.
- RBAC package was redesigned and PHP file storage was implemented for it.
- ReverseBlockMerge modifier was added to the arrays package. It is used in event configs in the application to ensure the correct order of handlers.
- A database migrations package was implemented.
- Configuration style more or less formed. It’s based on service providers now.
- Cycle ORM integration package got more cleanup, new configs style, and some extra features.
-
HTTP package got a
Header
class that contains constants for common HTTP headers. - Queue package was covered with more tests and got some bugfixes.
- HTTPS redirection middleware was added to yiisoft/yii-web package.
-
Yii development tool we use to develop Yii 3 with, got more tests and new features such as automatically fixing
composer.json
dependencies based on source code - Bootstrap 5 package was implemented.
- DI container started to resolve
Reference::to()
inside of arrays. - Automatic inflection-based naming for forms and controller IDs was introduced to ease day-to-day development.
- An integration package for the Bulma CSS framework was implemented. It is currently used in the application template.
- Progress was made on yiisoft/yii-rest package.
- Data package got a DataReaderInterface::readOne() method.
A bigger picture is available in a Trello board.
New and adjusted internal guidelines:
New and adjusted guide pages:
- What is Yii.
- Installing Yii.
- Running Applications.
- Saying Hello.
- Working with Forms.
- Looking Ahead.
- Middleware.
- Configuration.
- Aliases.
- Routing and URL generation
- Authentication.
- Glossary.
- The Chinese translation was started.
Reading recommendations
- Vue.js in legacy Yii app
- Fresh Yii and extension manuals in various formats
- Yii2 & Doctrine ORM simple integration
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: