Yii provides an application component model, modules, routing and Active Record. These features can accelerate conventional applications, but they should be used with clear boundaries.
Application components
Components expose shared services through the application configuration. Use them for genuinely shared infrastructure such as cache or mail transports. Avoid making every class a global component; explicit dependencies are easier to understand and test.
Modules
A module groups controllers, models and related functionality into a reusable application area. Define module boundaries around cohesive features, not merely around arbitrary directory size.
Active Record
Active Record maps records to objects and provides query and persistence methods. It is convenient for straightforward data access. For complex workflows, keep orchestration in application services and use transactions where multiple writes must succeed together.
Security and testing
Apply access rules on the server, validate input, encode output and protect state-changing forms against CSRF. Test both allowed and denied access paths.
Further reading
- Yii guide: https://www.yiiframework.com/doc/guide/