My thoughts on Laravel and Django

I am a self-taught web developer, having my first personal website built since I was around 14 years old back in year 2004. During that time, the Internet was just starting to be more helpful in gathering resources and information. Most of the website was built in HTML or PHP. So I started out my first webpage using PHP, without framework like Laravel.

Recently I began to switch from framework-less to using framework after I have not develop some web for some period of time. The first proper PHP framework that I had spent time learn is Laravel. Due to the nature and my previous experience on PHP, I was able to quickly pick up the framework within a month and start to build website in Laravel framework.

In my opinion, Laravel is way more easy to code PHP compared to without using any framework, aka. code from scratch. Laravel already provide a decent template and structure for me to start. It provides a proper way to manage URL routing which I couldn’t done it easily in previous method of coding where I have to make use of URL rewrite engine. Laravel also let me write my code in modular way with the MVC (Models, Views and Controllers) structure. I organized all my algorithms and logics in the Controllers while leaving the presentation layers in Views. The template inheritance saves me tons of time from duplicating same template over and over again, which in turn create more mess in the end. Database management is also an ease with the help of migrations. I can keep track of any changes I made to the database using different migration files. This also allow consistency across different server if I were have to migrate my website.

After awhile of coding with Laravel, I realized something I need is missing, the multithreading. Even though I have multiple CPU cores in my server, I cannot fully make use of these cores to complete my tasks faster. By nature, PHP is not a recommended language for multi-threaded processing. When I was dealing my research projects which required multi-threaded programming at the back end of the server, PHP cannot fulfill my needs. So I started to try out those modules that allow PHP to perform the tasks above. In the end, these modules generate more overhead than solving my problem.

I decided to try out django which is based on Python. That time, I have zero Python knowledge as I never learnt or used Python before. Fortunately, my knowledge in Java helped me learn Python easier due to similar concept and structure. After learning up django, what I would say is that, django is awesome! Multi-threaded programming is possible as everything can be done in Python! It’s more lightweight than Laravel because Laravel require tons of dependencies to be installed before started. Both django and Laravel have similar MVC structure, so switching from one to another doesn’t take much time.

There are some stuff where I feel is different in Laravel and django. For example:

  1. Editing setting during runtime is allowed in Laravel, but not in django. Trying to do so in django will give you errors.
  2. Variable processing in views is allowed but not recommended in Laravel. It is totally disabled in django unless using template tag.
  3. Laravel does not make use of regex while writing URL routing. You have to learn regex in order to properly write URL routing in django.
  4. django has a built in database administration panel. You can also manage your database in Laravel using PHPMyAdmin.

To me, both of the framework are decent in each language. If I need to write multi-threaded processing algorithms, I will choose django, else I might choose Laravel if I need to integrate with those old PHP system. It’s always better to work with sometime you already familiar with.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s