Aniket Singh

Choosing Best PHP Framework among CodeIgniter, Laravel and Yii

php
PHP Framewokrs

 

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.

approximately 81.2% websites are using PHP

Source: http://w3techs.com/technologies/segmentation/cl-it-/programming_language

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:

  • CodeIgniter
  • Laravel
  • Yii

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:

  1. Multilingual
  2. Form-validation
  3. Pagination
  4. WYSIWYG-Editor
  5. Mail
  6. Logging
  7. Encryption
  8. Unit Testing
  9. RESTful API
  10. Template Engine
  11. ORM/PDO
  12. 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:

  1. Know concept of MVC?
  2. Used any MVC framework?
  3. Know basics of ORM?
  4. Used CodeIgniter before?
  5. Used PDO?
  6. Used any template engine like Smarty?
  7. Used Yii before?
  8. Have a good knowledge about Model in Yii?
  9. Write test cases in PHPUnit?
  10. Know Concept of Namespace?
  11. 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.

CodeIgniter Official Documentation

37000+ Questions in Stackoverflow

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:

Laravel Official Documentation

Laravel Screencast

Laravel Forum

Live Chat Room

24000+ questions on Stackoverflow

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.

Yii Official Documentation

13000+ questions in Stackoverflow

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.