Why Laravel for an API that suggests health treatments
Nishanth KD
January 2, 2018

In September of 2017, ColoredCow began working on an application that was being used by cancer specialists to treat their patients. The creators of the application hired us to build the next version of their app. One of the planned features was to suggest the best-suited treatments for patients based on their medical conditions. Instead of building the feature into the application, the creators wanted to build it as a stand-alone API. The intent was to license the API to other applications working in the same domain.

The existing application was built on the CodeIgniter framework and when the time came to pick the framework for the API the creators suggested either CodeIgniter(PHP) or Ruby on Rails. Our pick was Laravel.

This is an account of why we suggested the Laravel framework.


Cost of Expertise

Cost of Expertise here is the cost of supporting development and maintenance of the app in the longer run. What kind of skill sets the app would expect from its tech team? What would it take to increase or decrease the team-size? These are some common questions one can ask while evaluating this cost.

After the release of Rails 5, it became a great option for building REST APIs. However, building it on Rails would mean the dev team would need expertise in Ruby as well as PHP. A developer or team that can program in Ruby, as well as PHP, would increase the cost and complexity of supporting the application in future. Something as good as Rails, in PHP, would be a better pick for this API in question.


Ease of Development

How much effort and time goes into building the API directly translates into to the cost of developing the API. The lower the effort, the lower would be the cost and it would also mean a better time-to-market.

Laravel has evolved over the years keeping one thing in mind, ease of development. With the Laravel introducing API Resources in version 5.5, it became our absolute favourite for building APIs. For tasks that would otherwise require writing tonnes code in CodeIgniter, in Laravel one can use artisan commands to do all of it in a fraction of minutes. These can be tasks like building an authentication mechanism for consuming the API or a transformation layer between the data and the API responses.

Rails 5 is built on a similar pattern and does better than CodeIgniter in terms of Ease of Development.

Concluding with Laravel

Laravel and CodeIgniter are PHP frameworks that would keep Cost of Expertise low. Laravel and Rails are great for building APIs with a high Ease of Development. Considering both of these factors, we picked the common one Laravel and with these considerations, the creators were also convinced to build the API in Laravel 5.5.

The first version of the API was released mid October and built on Laravel. We had initially projected a 6-week timeline for building version 1.0 in CodeIgniter, however Laravel took us just 4 weeks. To read more about how Laravel reduced the time to market and the cost of development continue reading here.