Cracking The “Laravel Vs. Cakephp” debate
I started off this thread to compare 2 frameworks for my next project which would have a team of 20 developers. Team experience was a bit skewed on CakePHP, but the experience outside the organization was tilted towards Laravel. The community buzz was definitely biased towards Laravel, but I wasn’t sure. Hence, I started to jot down some key points and here is the showdown
Niether of the 2 frameworks is the definitive choice. I realized that both do the job and will fit very well in a certain given scenario.
I decided to start working on Laravel 5.4
Here are my rough notes of what I observed about each of the two frameworks. I will let you decide for yourself which one fits the bill for what you are trying to do…
- CakePHP’s main focus is on HMVC framework. While that is a simple design, it’s great for websites
- Laravel focuses on several key enterprise design patterns. In addition to MVC Laravel allows you to work with IOC containers, event-drive, Factory, Facade etc.
- Laravel’s main focus is to support Services and build some sort of isolation between front-end and backend (business logic)
- Cake proves mode programmatic authentication methods like Form based auth, Basic Auth
- Laravel in addition to those provides more functional capabilities like Social auth. More importantly, we can secure Views/Routes and Services independently
- Cake offers “bake” which supports some basic code generation
- Laravel offers Artisan which is a CLI and basically allows us to do anything. Provides commands to help build the application ~ no dev errors in what being put where
- Laravel comes with Micro Services framework Lumen. Huge help in exposing data as JSON objects and allowing for Pagination, and eventually a MUCH BETTER INTERFACE
- Amazing community support and we have capabilities like Spark.
- Spark provides the scaffolding support that takes care of all the boilerplate code hence saving a huge amount of effort
- (this has 1-time cost)
- Laravel – Developer Wins
- IOC support – allows for much more dev-friendly model
- Support for Queues – very helpful to scale for us especially there are so many jobs we run. Using queues we can increase the parallelization of application without needing a lot of infra
- Templates (blade) are first class citizens and HTMLs don’t end up having HTML+PHP spaghetti code
- After a small learning curve, Laravel makes is a breeze for developers to work in. one of the developers worked for 2 days to learn and then was able to build 4 screens in 2 days with DB connectivity
- Laravel given its design naturally allows for unit testing. Unit Testing in CakePHP isn’t really possible. we end up doing either functional testing or UI testing (given its controller-model design)
- CakePHP’s strongest suite is ORM. We in DAV/GBMT given the nature of the applications, don’t make use of ORM.
- Laravel allows for database seeding which allows for easy QA/functional, security, performance testing
- CakePHP doesn’t offer anything like this OOTB and we will have to achieve this via CI or something
- We need to start building several modules as “plugins”. Cake’s support the same and so does Laravel (via packages).
- Google Trends – (https://www.google.co.in/trends/explore?q=laravel,cakephp)
- It will be wrong to say one is better that the other. The use case that suit each of them are kinda different. If you are looking to build a rather simple Website Cake works well (with it’s MVC). However, if you are looking to build more of a WebApp or some sort of back-end business processing – Laravel provides you various isolation layers and design patterns (IOC, Singleton, Facade) to build a robust enterprise application/tool.
- As of Jan’2017, Laravel is picking pace and is more popular of the two which means that if you are looking for a plugin to do a job, the chances of finding something in Laravel are higher (I am not saying you can’t find it in Cake)
- As for a developer – if you are looking to set governance, improve quality, do Unit testing – it’s easier to achieve the same in Laravel. In CakePHP, you can probably achieve all of that but it will end up moving away from what Cake recommends strongly (2 classes model-controller) is all what Cake offers
- Developer productivity is increased using the tools and ecosystem that Laravel provides like Artisan. they are not just code-generation but application building tools. common tasks like creating new controllers, views or adding test data in DB for testing, or creating Cron jobs for productions/QA are all done via one environment. you don’t have to so things outside of the framework. Some like the Cake model where these tasks are externalized