Yii 2 pros and cons
Yii 2 is still amazing
I am working on a project with Yii 2. I was not a big fan of this framework but I must admit it surprised me when I started learning it.There are many pro and cons about using this PHP framework. Let's try to write my own list:
- 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
- The last release is 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 for the basic template
- Code Generators are great too: Gii, fixtures, migrations, CRUD, models, modules etc.
- 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.
- 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
- The documentation about testing with Codeception is not complete and there is no update since a long time
- Codeception: multiple php configurations files are confusing, especially if you are using the advanced template. You have to be careful adding or updating parameters into these arrays and don't add the same parameter twice because a parameter can be overwritten when the main configuration do an array_merge.
- Codeception for Yii 2 package is deprecated but there is no documentation about using the codeception package with the framework both for the basic or the advanced template.
- 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