Revision #39 has been created by
rackycz on Oct 14, 2025, 1:58:01 PM with the memo:
edit
« previous (#38) next (#40) »
Changes
Title
unchanged
Yii3 - How to start
Category
unchanged
Tutorials
Yii version
unchanged
3.0
Tags
unchanged
Content
changed
[...]
First of all, learn what [PHP Standards Recommendations](https://en.wikipedia.org/wiki/PHP_Standard_Recommendation) by [Framework Interoperability Group (FIG)](https://www.php-fig.org/psr) are. It will help you understand why so many "weird" PSR imports are in the Yii3 code. In short: These interfaces help authors of different frameworks to write compatible classes so they can be reused in any other framework following these principles.
## Dependency injection + container
Check [this YouTube video](https://www.youtube.com/watch?v=TqMXzEK0nsA) for explanation
## construct() and invoke()
It may be confusing that some classes contain both methods if the reader does not have experiences with invoking. Just like me a few days ago. invoke()
The `__invoke()` is called when you call the **instance** as a method. Like this:
```php[...]
```
Note that "property promotion" should be only used in `__construct()` just like the dependency injection.
## Hash annotations for class attributes
PHP 8 introduces annotations like this (not only for class attributes):[...]