Yii3 - How to start

Comparing #33 with #34

Revision #34 was created by rackycz rackycz on Oct 14, 2025, 7:24:24 AM.

edit

Content

[...]
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

##
__cConstruct vs __iInvoke It may be confusing that some classes contain both methods. Note that "property promotion" should be only used in `__construct()`. Magic method `__invoke()` is only used if you create an instance and then use it as a function. Example:

```php
$obj = new MyObj();
$obj(); // Now the __invoke() is executed
```
[...]