Yii 2 pros and cons
I am still surprised about the Yii 2 popularity: I love this framework and I have based a couple of important projects on this framework. I love its presentation, code generators and the easy way you start, develop and test each element of your project. You can even have a test database and test all database operations. So I think you don't anything else. Perfection doesn't exist so I have list of advantages and disadvantages but I ensure you that all the advantages will push you to use or at least try Yii 2!
PROS
- Basic and Advanced template: you can choose even other templates but these are 2 great choices. The advanced template is great even for medium and large applications. These templates contains the code with many features already working and well implemented.
- Active Record is simple and very easy to learn
- Good documentation. They have recently updated the incomplete parts.
- The last release is always strong and stable
- Codeception is well integrated into the framework and it lets you to write acceptance, functional and unit testing
- Simple and intuitive directory tree both for basic and advanced template
- Code Generators are great too: Gii, fixtures, migrations, CRUD, models, modules etc. When you need to update a file you simply have to be careful to update the customized parts. The version control software will help you.
- The BEST integration with Twitter Bootstrap you can find on the web for a PHP framework
- Admin Lite template for the backend is absolutely AMAZING!
- Many cool features were developed BEFORE some new and updated frameworks like Symfony or Laravel
- Working with form models seems even strange at the beginning but it's reasonable and you will understand how it can be useful developing your own application
- A pretty large community is still using this framework and you can find a lot of tricks and informations on stackoverflow
- Active Record acts with singleton. There is not an Entity Manager object like you have it in Doctrine. With Active Record you generate the models instead of generating entities. It's almost the same.
- Codeception: testing was difficult but now you can have separated test suites for each projects. This seems confusing but it's useful if you are working with multiple projects using the Yii2 advanced template.
- If you want to check the source code, you will see it's very simple and you can easily understand how the framework works.
CONS
- To mock and test the Active Record models is difficult and almost impossible Aspect Mock doesn't work for me on Yii2: it seems there is a conflict with the Yii 2 autoloader. You have to use a a test database and run your Codeception test suite.
- No updates since a very long time and no news about a new framework version
- It seems to organize controllers into sub directories is pretty difficult. You have to write your own routing rules
- Views: PHP templating is confusiung and the code will always look dirty. You can use Twig for Yii2 and let the code to be cleaner
- RBAC, migrations and fixtures are intuitive but the documentation is not so clear and i have had a lot of difficulties to understand how to implement these features
- If you are using Admin LTE for the admin area, it's difficult to switch to bootstrap 4 or another CSS framework. You have to update the code generators and integrate all the components (pagination, breadcrumb, buttons etc.)