It may be surprising that approximately 81.2% websites are using PHP as their server-side language. Nowadays lots of PHP frameworks are being used for websites development. Many CMSs like WordPress, Drupal, Magento, Joomla are also coded in PHP. WordPress challenges that it powers 27% of Internet.
If you are using PHP for your web application then this blog may be useful for you. I have worked in some frameworks and also did some research to finding a good one for my projects. I just wanted to share my experience as a pear.
Whenever you get a new project, you have to select a framework that may suit best for your project. I think here “best” can be defined as “less effort and less complexity”. Right?
It will be better that whatever you need in your project, should be already available in framework. For example you need to send emails. You got a library added in your framework and just needed to fill SMTP settings, you used a `sendMail()` method, and it’s working. Of course you saved time and effort.
Now suppose you don’t need to send emails in whole project, then this functionality is useless for you. Same for Unit testing, Multilingual, ORM/PDO, WYSIWYG-Editor, Form-validation, Logging etc.
I just want to say that always choose framework as your requirements not as popularity.
You should use a MVC framework to keep your code simple and organized.
The best MVC frameworks in PHP which I suggest to use:
For deciding any framework you should be clear about your requirements, what you already know, and what you want to learn.
Check your requirements in project:
- Unit Testing
- RESTful API
- Template Engine
- Database Seeding & Migration
If you need approx half of them and most of it from top 7 points, then CodeIgniter will be better for you. And if you need approx all of them then you can choose Laravel Or Yii.
Check what you already know:
- Know concept of MVC?
- Used any MVC framework?
- Know basics of ORM?
- Used CodeIgniter before?
- Used PDO?
- Used any template engine like Smarty?
- Used Yii before?
- Have a good knowledge about Model in Yii?
- Write test cases in PHPUnit?
- Know Concept of Namespace?
- Used commands to maintain your server?
If you know 4 or less than 4 from above list, then you should choose CodeIgniter, If you know 8 of them including 7th and 8th then you may choose Yii and if you know approximately all of them you should use Laravel. And if you have enough time for project and want to learn then it doesn’t matter what you know just choose Laravel, you will learn a lot.
Frameworks on basis of Supportability:
CodeIgniter:CodeIgniter is easy to learn due to it’s simple and organized structure. It has very basic and limited functionalities that’s why it’s not complex. Official documentation is enough for starting development in CodeIgniter.
Laravel: Laravel is much complex than CodeIgniter due to having a lot of functionalities. So of course it has lots of confusions but you will never feel any lack in support, Some references are:
Yii: Yii is little bit complex that CodeIgniter, It provides a UI for back-end and helps to create Models very easily, but If you don’t have any experience in it or don’t have any colleagues, experienced in it then it going to be a tough task for you because its documentation is not good as I knew. If you are enthusiastic to learn it, books are available on Amazon.
1 line for each frameworks:
CodeIgniter: Best for small sites, simple, good documentation, lots of users.
Laravel: Best framework in PHP, has everything which may be needed in project, takes time for beginners.
Yii: Used for huge projects, better communication to database, complex and bad supportability in comparison to Laravel.